Click here to Skip to main content
15,888,733 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Issue Reading and Writing to Serial Port Pin
BubbaGeeNH22-Dec-09 3:59
BubbaGeeNH22-Dec-09 3:59 
GeneralRe: Issue Reading and Writing to Serial Port Pin
Luc Pattyn22-Dec-09 6:38
sitebuilderLuc Pattyn22-Dec-09 6:38 
QuestionExtension Methods feature over mixed solution (managed c++ to C#) [solved] Pin
Martin#17-Dec-09 2:12
Martin#17-Dec-09 2:12 
AnswerRe: Extension Methods feature over mixed solution (managed c++ to C#) Pin
N a v a n e e t h17-Dec-09 16:56
N a v a n e e t h17-Dec-09 16:56 
GeneralRe: Extension Methods feature over mixed solution (managed c++ to C#) Pin
Martin#17-Dec-09 19:36
Martin#17-Dec-09 19:36 
GeneralRe: Extension Methods feature over mixed solution (managed c++ to C#) Pin
N a v a n e e t h17-Dec-09 20:51
N a v a n e e t h17-Dec-09 20:51 
GeneralRe: Extension Methods feature over mixed solution (managed c++ to C#) Pin
Martin#17-Dec-09 21:26
Martin#17-Dec-09 21:26 
GeneralRe: Extension Methods feature over mixed solution (managed c++ to C#) Pin
tonyt24-Jan-10 15:09
tonyt24-Jan-10 15:09 
I was a little confused by your original question, but if are are trying find out if it is possible to <b>implement</b> extension methods in C++/CLI (that can be consumed from VB and C# as extension methods), the answer is yes.

You just declare a C++/CLI class that is both abstract and sealed, and you apply the [Extension] attribute to both the class and the extension methods you add to it, which must be public and static. The extension methods themselves do not use the 'this' keyword like they do in C#, but they're seen as extension methods by the VB and C# compilers. The example below implements a "Matches()" method for System.String:

<pre>
#pragma once

using namespace System;
using namespace System::Runtime::CompilerServices;
using namespace System::Text::RegularExpressions;

namespace System
{
   [System::Runtime::CompilerServices::Extension]
   public ref class StringExtensionMethods abstract sealed
   {
   public:
         [System::Runtime::CompilerServices::Extension]
         static bool Matches( System::String^ string, System::String^ pattern )
         {
            return Regex::IsMatch( string, pattern );
         }
   };
}
</pre>
GeneralRe: Extension Methods feature over mixed solution (managed c++ to C#) Pin
Martin#24-Jan-10 22:42
Martin#24-Jan-10 22:42 
Question“An unhandled exception of type 'System.IO.FileLoadException' occurred in Pin
vibindia16-Dec-09 15:21
vibindia16-Dec-09 15:21 
Questionmanaged c++ app refuses to run Pin
Jason Henderson16-Dec-09 8:10
Jason Henderson16-Dec-09 8:10 
AnswerRe: managed c++ app refuses to run Pin
N a v a n e e t h16-Dec-09 14:47
N a v a n e e t h16-Dec-09 14:47 
GeneralRe: managed c++ app refuses to run Pin
Jason Henderson17-Dec-09 2:52
Jason Henderson17-Dec-09 2:52 
AnswerRe: managed c++ app refuses to run Pin
teejayem17-Dec-09 4:43
teejayem17-Dec-09 4:43 
GeneralRe: managed c++ app refuses to run Pin
Jason Henderson17-Dec-09 4:59
Jason Henderson17-Dec-09 4:59 
GeneralRe: managed c++ app refuses to run Pin
YoavStein7-Feb-10 2:57
YoavStein7-Feb-10 2:57 
QuestionHow to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Nilesh Hamane14-Dec-09 0:48
Nilesh Hamane14-Dec-09 0:48 
AnswerRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Andreoli Carlo14-Dec-09 3:16
professionalAndreoli Carlo14-Dec-09 3:16 
AnswerRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Richard MacCutchan16-Dec-09 9:08
mveRichard MacCutchan16-Dec-09 9:08 
GeneralRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Nilesh Hamane16-Dec-09 22:07
Nilesh Hamane16-Dec-09 22:07 
GeneralRe: How to send messages from pc to pc in LAN without turning 'Messenger' service on? Pin
Richard MacCutchan16-Dec-09 22:22
mveRichard MacCutchan16-Dec-09 22:22 
QuestionDataGridView multiline selection without ctrl key Pin
Andreoli Carlo10-Dec-09 23:39
professionalAndreoli Carlo10-Dec-09 23:39 
AnswerRe: DataGridView multiline selection without ctrl key Pin
Andreoli Carlo13-Dec-09 22:18
professionalAndreoli Carlo13-Dec-09 22:18 
QuestionCenterParent in Windows 7? [modified] Pin
Xpnctoc9-Dec-09 3:56
Xpnctoc9-Dec-09 3:56 
QuestionRe: CenterParent in Windows 7? Pin
Mark Salsbery9-Dec-09 6:42
Mark Salsbery9-Dec-09 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.