Thread: What advantages does C# have?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    100

    Question What advantages does C# have?

    I have learned some C and C++, but I have not yet studied C#. I'm not criticizing the language, but I'm just wondering and trying to find out-why use C# instead of C++? What advantages/disadvantages does it have when compared to C++. If Microsoft runs bankrupt or something ten years from now, will that have any impact on the usefulness of C#?

    Thanks,
    jsrig88

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    C# is a more high-level approach than C++. It is usually faster to develop in. It comes with a large framework of predeveloped components, which makes it particularly useful for server-side programming. It is full of features that make development faster and easier, usually at the cost of flexibility and/or runtime performance.

    If MS goes bankrupt, C# is not dead: it is a standardized language, as are the core parts of the framework. However, large parts of the .Net framwork are still MS's own and in the unlikely case that MS drops C#, there would probably be a significant loss of investment.
    On the other hand, and though I'm not really knowledgeable about the subject, I'd guess Java users would suffer more if Sun dropped out; in some ways at least.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    164
    I am not the most experienced nor considered an expert or even advanced user in C, C++ or C# but I can speak to what I have done between C++ and C# and the books I have read about the comparisons.

    CornedBee said most of them already and had a great break down. I use C++ for fast responsive hardware based programing or socket type programing, network stuff where I need really fast response times.

    I use C# for programing mobile devices such as windows mobile or windows CE for the Visaul Studio .Net components for easy coding and connectivity on such platforms. Also most the coding I have done or seen done with web services and alot of server to server services of the type C# has some really neat components for simplifying code. It also simplies database programing for MS SQL Server, also Oracle, but mostly SQL, by simplifying connections and query execution.

    I have really had to adopt both principles, C# and C++ in the past 3 years at the place I work because of the multitude of different applications, machine, server and mobile devices, like Symbol Mobile Computers. I enjoy them both, but ask me my preference and I guess because of my old nature, I like C++. But you will want to adopt the .Net Extended C++, .Net VB and C# if you want to excel in the MS Windows Programing World, at least thats what I have seen in profession.

    Hope that helps-

  4. #4
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by WaterNut
    CornedBee said most of them already and had a great break down. I use C++ for fast responsive hardware based programing or socket type programing, network stuff where I need really fast response times.
    strange that you say that for network programs where most time is spent waiting for network I/O and has nothing to do with language.
    I also noticed a trend on this forum that a large part of all topics are about performance

  5. #5
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    Like you say , you spend most of the time waiting for the network I/O , then its essential to do whatever it is that is needed to be done with the data and get ready for the next bunch of data...

    For instance, you are programming the IOS of a router, you already need to wait before the signal traverses the whole cable length, then the last you want is to introduce more latency because of the things the IOS is performing on the data ( for example acl's , check routing tables etc etc ).

    You really have to look at the whole picture.

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by GanglyLamb
    For instance, you are programming the IOS of a router, you already need to wait before the signal traverses the whole cable length, then the last you want is to introduce more latency because of the things the IOS is performing on the data ( for example acl's , check routing tables etc etc ).

    You really have to look at the whole picture.
    at first I agreed with you, but then I noticed you're somebody else then who I quoted.
    He was talking about sockets windows programming, not about routers or something where C# is not in the picture at all.

    This is like saying:
    "I choose C if I do socket programming on windows cos I want speed"

    "speed that doesnt matter with sockets its np to use C#"

    "but I have a commodore 64 on which I'm making a router so I have to use C"

  7. #7
    "Why use dynamic memory?"
    Join Date
    Aug 2006
    Posts
    186
    well, it's more "visualish" so it's easy to work with, however, it doesnt really have "real" pointers and not as fast as C++ or C and it only works under .NET development
    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
    Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

  8. #8
    Registered User C of Green's Avatar
    Join Date
    Jan 2002
    Location
    Calgary/Canada
    Posts
    59
    C# supports "real" pointers with the unsafe keyword

  9. #9
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Quote Originally Posted by Hussain Hani
    well, it's more "visualish" so it's easy to work with, however, it doesnt really have "real" pointers and not as fast as C++ or C and it only works under .NET development
    Heh, the old saying goes the first major hurdle in C++ is learning how to use pointers, and the second major hurdle is learning how not to use pointers.

    I've used C# on two projects and I absolutely love the rapid development time; I've never had an application yet where speed differences become appreciable, but I can develop a fully working program in maybe a third of the time in C# (probably more like 1/10th the time compared to pure WinAPI which is nice to know but too slow to develop with for my tastes).
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    In my opinion there are two big advantages in using C# over C when you consider most windows based programs, except for 3D games:

    - The trend established itself. Many companies require programming experience in C#. It won't hurt to have this knowledge if you plan to proceed with a career in windows programming.

    - Microsoft Products already dropped their native C++ rapid application development tools. If you need to visually program in C++, you can't anymore with Microsoft Studio line of products. Windows based development in native C++ has dropped in speed considerably for the C++ programmers insisting on using the latest Microsoft development software for GUI based development. This seems to indicate Microsoft is trying to push programmers away from MFC and eventually drop it altogether (something probably a few good years away still). C# becomes then a programming language to take into consideration, since I don't see Microsoft stepping back from their strategy anymore, and support for native C++ GUI programming becoming more and more a thing of the past for Microsoft products.

    Considerations of performance or specific language features are usually void, unless there is a critical need for them, which usually is not the case on a large amount of programs. There will always be room for C++ in windows programming though, unless a major revolution occur. And it is still the language of choice for too many problems, ranging from software that one wants portable to software that uses specific technologies or techniques that other languages find it hard to offer (3D being one of the major examples).

    There is also a huge amount of knowledge worldwide around C++ that is freely shared, openly debated, and which future development is decided by the community. Three aspects a proprietary language can never compete against.

    So I'd say if you want to program in windows, and you want to make this your career then you should learn C# while keeping a solid knowledge in C++. If you don't want to become a professional programmer then it's your choice if you do or not. If you don't want to program in windows, then you don't need C#.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    The main advantage it has is the # in the name. Every one knows that C++ is better than C, because it has a ++ on the end of its name. Knowing this, it's obvious that C# is far superior to C++, because its symbol is the natural, well at least in Microsoft's eyes, extension of that.

    How's that? Well what's better than one? That's right. Two. Two is better than one. Two ++ must be better than one ++, right? Clearly they couldn't call it C++++, because that would be too many things to type. But wait, what if we stack them?
    Code:
     ++
    C++
    Ladies and gentlemen, I give you, C#. Clearly superior.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. advantages of using IDE
    By surrounded in forum C Programming
    Replies: 8
    Last Post: 03-03-2009, 06:36 AM
  2. Advantages of using macro for BIT positions
    By donmorr in forum C Programming
    Replies: 8
    Last Post: 07-23-2008, 06:15 AM
  3. [newb] Can someone explain the advantages of OOC?
    By TheUnknownFacto in forum C++ Programming
    Replies: 5
    Last Post: 04-20-2007, 07:38 PM
  4. advantages of tile-based engine...
    By o0obruceleeo0o in forum Game Programming
    Replies: 25
    Last Post: 07-22-2003, 08:03 AM