Click to See Complete Forum and Search --> : Mix Codes???


lior6543
April 19th, 2005, 06:45 PM
Is it possible to mix codes?
C Sharp & C++.NET in the same file or on separate files but on one project?

something like:

System::Windows::Forms::ListView * listView1;
System.Windows.Forms.ListView listView2;

andreshs1
April 20th, 2005, 01:53 PM
you can import methods, but they need to be updated.

as for files, you cannot include .h files on a C# project, although you can convert those files into DLL and use DLLImport to import then into C#.

cilu
April 25th, 2005, 09:34 AM
You can use types cross-language as long as they are CLS compliant. You can write a class in VB.NET, specialize it in C# and then use it in managed C++. But they must be CLS compliant.

lior6543
April 25th, 2005, 05:48 PM
what is "CLS compliant" ?

cilu
April 26th, 2005, 04:22 AM
CLS is a set of rules that defines a subset of the CTS that enables cross-language usage of types.

Not all the types are CLS compliant, that is follow the rules of CLS. For instance VB.NET does not have unsigned integral types (except for byte). Because of that the unsigned types are not CLS compliant, since they cannot be used in VB.NET. Any type that exposes a method or a property that uses an unsigned integral type is not CLS compliant.

You can start reading more from here:
Relationship to the Common Type System and the Common Language Specification (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconrelationshiptocommontypesystemcommonlanguagespecification.asp)