NOTE: This article is obsolete for Visual Studio .NET users.
I wouldn't compare C# with C++. C++ is just great. You can compare C# with other languages such as Java. I was working on how to create components using C# and I liked it. Its very easy then creating components in VC++.
In VC++, we can create components in different ways such as regular dll, extension dll. Calling these components from a client is a lengthy process. You have to export/import functions or classes, then you have to include header files, copy dll to appropriate directory and then link to lib.
Creating and using a component (dll) in C# is fair easy than in C++. Here are few simple steps:
- Create a class with no Main function. Say your class was MyClasss and you add one function called MyFunc. Suppose you save this file as MyClasss .cs
- Compile that class with csc /out:MyClasss.dll MyClasss.cs
These two steps will create your component as a dll named MyClasss.dll.
Now using this component is pretty simple task. You write these two lines in your program's Main function.
MyClass cls =
new MyClass();
cls.MyFunc();
Pretty simple? huh?? See my article "How to Create a component using C#" for more details.