In actual fact you could expand this to include the same information in all the books on C#, covering classes, inheritance, events, delegates, custom attributes & their uses, garbage collection and how it works, remoting, using the web classes etc etc etc etc.
How come as soon as we're talking about coding anything it's gone cold ?
I could continue this FAQ if you wished...
Darwen.
www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.
We are now working to continue / replace the current set of FAQs for C# and will eventually get additional ones going for C++, VB.NET, ASP.NET, and more.
-----------------------------------------------
Brad! Jones, CodeGuru.com Site Director
Developer.com Network Director / EiC
I found the tutorials (right up at the top - first post) to be very useful but I have a few questions that might be common to newbies who are coming to C# and .NET from a C++ background. For example....
1) Is it advisable to try and "convert" existing C++ projects to C# or is this just making life difficult? Is it better to leave existing projects as they are and start using C# only for new projects?
2) If it's possible to convert existing projects are there any tools to help automate the process?
3) Is there any easy way to relate the concepts of C# to their C++ counterparts. For example, a class is presumably the same thing in both. But I've seen C# classes with definitions like:-
public class MyClass : Sytem.Windows.Forms.Design.ControDesigner
Firstly, what does all that mean?? Secondly, it suggests that private classes are possible without having the class as a member of another class. True or false?
4) The C# projects I've seen don't seem to have the equivalent of header files. Is that generally the case or not?
5) Is there any "obj" level (i.e. intermediate level) compatibility between the two? For example, could a C++ project use C# objects at all or not? Are the two in any way inter-mixable?
I guess there'll be other common questions too but that's probably enough to be going on with, for the moment !!!
"A problem well stated is a problem half solved.” - Charles F. Kettering
You're better off asking these questions in the forums really...
In answer to your questions :
(1) "public class" means that the class is accesible from outside the assembly. "internal class" means the class is only accessible from inside the current assembly. In executables it doesn't have much meaning.
(2) System.Windows.Forms.Control is the name of the class including the namespace. You have namespaces in C++ seperated using :: - e.g. std::vector. In C# a period (full stop) is used.
(3) Managed C++ can use class libraries (dlls) written in C# by the #using directive - sort of like #include only for class libraries. C# can use managed C++ assemblies by adding them as references to the project.
(4) You can't mix up C# with C++ in one assembly.
Any more questions like this should be put to the C# forum.
Darwen.
www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.
Bookmarks