Re: C++ vs C#



"TStoltz" <stoltzo@xxxxxxxxxxx> wrote in message
news:427f9d42@xxxxxxxxxxxxxxxxxx
> Hi,
>
> I'm sorry if this question comes inapropriate but hope you can help me
> answer the following:
>
> What is the difference between C++ and C#.

C# is a member of the C family of languages, much like Java. In fact it
shares many similarities with Java since both target a managed environment.
C# could be seen as a "simple" C++, without macros, templates, and multiple
inheritance. It adds first class support for properties and events, and
replaces function pointers with delegates, which are effectively type-safe
function pointers. C# 2.0 has generics which are similar in some respects to
C++ templates. C# also does not support deterministic finalization, since it
relies on the .NET garbage collector to handle memory.

> Can I use C++ code within the C# code.

Not directly no. C# can call into other .NET assemblies, including ones
developed with Managed C++, or C++/CLI (both are basically C++ flavours
targetting .NET). Via COM Interop C# can call C++ code which was compiled
into a COM DLL, and via PInvoke C# can call C++ code compiled into a Windows
DLL.

Managed C++ and C++/CLI offer an additional interoperation capability called
IJW, which allows you to use unmanaged C++ code in your managed C++ DLLs.
Needless to say this is very useful if you have a lot of C++ code you need
to work with.

>I've heard postive things about Framework which should be similar to MDSN -
>or what is it better/worse?

Do you mean MSDN? If so, this is just the Microsoft developer documentation.
The Framework is the actual .NET system.

> Please tell me why I should go for C-sharp instead of C++

There's no hard and fast rule here. Basically if you've decided to target
the .NET Framework, and you're not doing too much communication with C++
code, then C# will generally get your code out the door quicker and with
less bugs. This is a function of both the cleaned up syntax and the memory
management features of the .NET framework (which are also available with
Managed C++ and C++/CLI).

I much prefer C#, since I find it has a much cleaner syntax than C++ and
less ambiguities. Switching from C++ to C# led to a 50%+ developer
productivity boost on one of the projects I was involved in. That said, C#
is not a panacea for all ills, and sometimes you are better off with C++,
but these situations are few and far between in my experience.

> Thx


.



Relevant Pages

  • Re: Pocket PC Deployment
    ... You're going to need ActiveSync on the target PC at a minimum. ... you can use RAPI from native code to copy the files to the device ... the target computer need to have the .net framework on it? ...
    (microsoft.public.pocketpc.developer)
  • Re: Possible to distribute without dotnet framework?
    ... Depending on which framework version you need, the target computer needs the ... Microsoft .NET Framework 3.0 Redistributable Package ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Running on version of .NET older than build version
    ... that "An application created with the .NET Framework version 2.0 can ... target only version 2.0." ... been updated for MSBuild. ... MSBee .targets file." ...
    (microsoft.public.dotnet.languages.vc)
  • Detecting the version of .Net framework...
    ... We are developing a product which requires .Net Framework 1.1 SP1. ... target OS could be any of Win2000/XP/Win2000server/Win2003 server. ...
    (microsoft.public.dotnet.framework)
  • Re: asp.net: Change .NET version in Web.config
    ... ASP.NET applications use aspnet_regiis.exe ... to set the version of the .Net Framework they target. ... Juan T. Llibre, asp.net MVP ...
    (microsoft.public.dotnet.framework.aspnet)

Loading