Starting From Scratch - Should I use (MS Visual Studio) C# or (MS Visual Studio) C++? [closed]
I'm starting a new project from scratch. I'm trying to determine if I should use C# of C++. Either way, it would be the MS Visual 2010 Express version of it.
From a application use perspective, I'm pretty sure it won't matter to the end user of the application I want to build.
For me, though... two things. 1) I need to use a database and will be using MS SQL Server. This should affect C# or C++? (but I think C# is a little easier...) and 2) there is an open source code library that I may at some point want to incorporate into my application. It's written in C++.
I can code in either. C# seems to be easier these days. But C++ would let me use that library...
What else should I be considering here?
Thanks in advance!
-Adeena
C# is a way easier. The base class library allows to setup afficient communication with SQL Server. This application is gonna be easier to maintain. And you can always call external methods of the .dll writtern in C++ from within C# application using language's Interop services feature.
See also:
- extern (C# Reference) at MSDN
- Interoperability Overview (C# Programming Guide) at MSDN
- How to: Wrap Native Class for Use by C# at MSDN
If you think C# is easier then use C#, as far as the open source lib, you want to look at using Platform Invoke in C#.
You could use either and come out OK in the end. The key to virtually all software engineering is reducing overall maintenance costs, and in that light, C# is probably easier to maintain than C++.
Your database won't really make a difference because both languages are built to use with the .NET framework -- and you can use Language Integrated Query (LINQ) to wrap your database tables into actual objects to help abstract the database operations, which should make things easier.
EDIT:
Apparently LINQ is only natively for C#. I always thought it was for the whole framework... This factor alone should be enough to swing you to C#.
You can call an unmanaged C++ method from a C# application by using P/Invoke.
C# has way, way better database interoperation using LINQ. You can just use P/Invoke to communicate with the C++ DLL or C++/CLI if you're really desperate for it.
精彩评论