C# for a C++ coder

This is a discussion on C# for a C++ coder within the C# Programming forums, part of the General Programming Boards category; I've been doing C++ coding for over 10 years but soon I start a job using C#. So I've been ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    330

    C# for a C++ coder

    I've been doing C++ coding for over 10 years but soon I start a job using C#. So I've been studying C# and is all easy to understand, looks a lot like C++.

    But my question is will there be any pitfalls to watch out for when coding C#? Like boxing, that looks like I could easily create unefficient code when working large structs. Are there any more pitfalls to watch out for?

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,159
    Depends on what you're going to be working in I guess. Console, WinForms, WPF, ASP.NET? Stick with generics when possible for efficiency. Knowing the .NET framework well is the biggest thing.

    Also, coming from C++ you're probably used to multiple inheritance, which C# doesn't support. Get used to interfaces.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    its going to be big database system running from a service

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    Also, coming from C++ you're probably used to multiple inheritance..
    It supports multiple inheritance of interfaces which is also good practice in C++.

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Quote Originally Posted by VirtualAce View Post
    It supports multiple inheritance of interfaces which is also good practice in C++.
    yeah but I have seen code bases where virtual inheritance was used. If it can be used it will be used and it cant be used in C# which is a good thing

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    Multiple inheritance is supported in C# with the exception that a class cannot inherit more than one base class (concrete base class) at a time. However it is perfectly valid for one concrete class to inherit from another concrete class although I usually advise against this type of design. However, in C++ you can do this and in the hands of an experienced C++ programmer this is a powerful thing. Again I'm not saying never use multiple concrete inheritance in C++ and ultimately it comes down to the requirements of your project and the approaches you must take to meet them. There are situations where multiple concrete inheritance is not a bad thing.

    But back on topic, both C++ and C# support multiple interface inheritance. I have not seen virtual inheritance used that much. Virtual inheritance to me means that there is only 1 copy of the base class in the derived class. This is useful when you have the dreaded diamond pattern. The two edges of the diamond can use virtual inheritance to resolve ambiguities.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hiring a coder
    By ICool in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-11-2007, 02:34 PM
  2. new coder using Dev C++
    By newcoder3333 in forum C++ Programming
    Replies: 3
    Last Post: 07-29-2006, 05:35 PM
  3. C++ coder needer for a HL2 Mod
    By Cyph3rs in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 07-31-2005, 06:06 PM
  4. HL2 mod needs coder
    By livewire in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 07-30-2005, 10:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21