473,661 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why C#

Hi All,

The question is why should I use C#?
If am developing a windows application, what are the advantages of using C#
versus VC++ (MFC)?
Thanks
AliR.
Nov 23 '05 #1
12 1179
In the end, it depends on the person. There will be some people that
find using MFC much easier than .NET. However, most people find that .NET
is about a gajillion times easier to use than MFC.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"AliR" <Al**@online.no spam> wrote in message
news:cG******** **********@news svr25.news.prod igy.net...
Hi All,

The question is why should I use C#?
If am developing a windows application, what are the advantages of using
C#
versus VC++ (MFC)?
Thanks
AliR.

Nov 23 '05 #2
I'm not going to get into a language war - use whatever fits your style and
the needs of your application - however, I will say that you will help
yourself if you dump MFC and switch to .NET - with either C# or C++ (or any
of the other languages available).

I used C++/MFC for many years. Then I switched to C#/.NET for personal
projects when that was available, because the C++ support for .NET was pretty
disappointing. Now, C++/.NET is a much more viable solution, and I am
thinking about switching back to C++ again (which is what I use at work all
the time).
"AliR" wrote:
Hi All,

The question is why should I use C#?
If am developing a windows application, what are the advantages of using C#
versus VC++ (MFC)?
Thanks
AliR.

Nov 23 '05 #3
"AliR" <Al**@online.no spam> wrote in message
news:cG******** **********@news svr25.news.prod igy.net...
The question is why should I use C#?
If am developing a windows application, what are the advantages of using
C#
versus VC++ (MFC)?


That's very difficult to quantify. The "general" consensus of opinion is
that .NET is *MUCH* easier to use than MFC so, logically, you could expand
on that and say that easier to use means quicker to develop, and quicker to
develop means quicker to market, and quicker to market means faster return
on investment...wh ich can only be a good thing... :-)

However, only you can decide whether you find .NET easier (i.e. quicker)
than MFC...
Nov 23 '05 #4
Hello AliR,

(usually I see you in the C++ sections!) Our company has decided to go with
C# for our new devlopment for a few reasons (we still use C++ on a ddaily
basis).

It just works. It makes more sense and you use a lot fewer lines of code to
do the same thing as in C++... Like with the TansparentStati c text... C#
already takes care of that automatically (your class saved my neck on a
deadline though for C++!).

The controls look a lot better.

Version control should be a lot better with the OneClick development
(compared to our current method).

Office automation (what a nightmare) is supposed to be easier and I have
been finding more documentation for it than with C++. ... Actually I have
found more examples with VB.NET which I think we can still incorperate in our
C# code (not sure how that works yet).

From what I have read there is supposed to be more consistancy accross OS's
using C# (or just .NET in general) since it is the same framework. I know we
have had problems in the past between differnt Windows versions with some of
the software we write in C++.

Sockets are supposed to be easier according to my comrade in the next room.
He said something about SSL being built in to the .NET framework whereas we
are having to use a 3rd party library for it in C++.

Alot of these things are just projections and things I have been told to be
true... and with the little programming I have done so far, a lot of it
checks out. I am not a pro though (entry level, small company). Pleaes
don't hold me responsible for these comments if they are in error... these
are the preconceptions I have about it from what I have read, etc... Can any
one confirm these comments?

Rob K
"AliR" wrote:
Hi All,

The question is why should I use C#?
If am developing a windows application, what are the advantages of using C#
versus VC++ (MFC)?
Thanks
AliR.

Nov 23 '05 #5
> If am developing a windows application, what are the advantages of using
C#

The main reason I moved from VB to java (bear with me for a sec. :>) was
cause it was closer to the OS, lower level power than VB, but not so low as
the C++ layer. I was rather disappointed with java though (just overall,
everything was rough around the edges). Then I started looking at C# and
found it VERY nice! Yes, it is easier IMHO, like others have said. But
what makes it easier?

First thing that comes to mind is NO MORE POINTERS!!!!!!! !! haha But the
truth be told, you still do have them, they're just called references. I
went to VB from C cause I hated pointers! Then after learning more and more
about java, they have pointers as well (like C#, just by another name,
references). So that was a bummer, but then you get over it and move onto
my next point. :>

The major thing that makes C# nice, easy to use, is it allows you to
concentrate on WHAT you're trying to do, not HOW. It's the WHAT that I love
so much! With Visual Studio (any version :>), you can simply draw your
form, double click controls, add handlers, etc. You're into the meat and
doing what you want to do. With C++ I find you spend sooooooo much time
setting things up, setting up the framework, getting the communications,
setting up classes, etc. IMHO, there's soooo much time wasted on the HOW,
by the time you get to the what, you're bored and don't care anymore.

But that's must IMHO. Good luck! :>
Nov 23 '05 #6
Hi Rob,

I am glad the Transparent Static class helped you out. :)

The reason I asked this question here is that, for the past year every time
I talk to a headhunter about jobs they tell me that they haven't ran into a
C++ job in a while, and all the companies that they deal with want C#
programmers.
I have read a book on C# (Teach yourself in 21 days, got it free from
codeguru for my Transparent Listbox), and I am reading the Wrox Beginner C#
..net 2005 now. What I have noticed so far is that it is easy to develop
simple dialog base applications (I don't deny that), but it seems very
difficult when it comes to MDI applications. Specially in regards to Docking
windows, menu/toolbar management. I also find it's event handling a bit
convoluted. It's just not easy to read, and know what events are being
handled and which ones aren't.

So the reason I asked this question here is that I wanted to know why people
prefer C# over C++. I don't have enough expirence with C# to make a good
judgment about the language, but from what I have seen so far I find MFC
easier to deal with, and alot more flexiable than C#. So I wanted to find
out from people who actually use C# what they find like about it.

AliR.
"RobKinney1 " <Ro********@dis cussions.micros oft.com> wrote in message
news:CD******** *************** ***********@mic rosoft.com...
Hello AliR,

(usually I see you in the C++ sections!) Our company has decided to go with C# for our new devlopment for a few reasons (we still use C++ on a ddaily
basis).

It just works. It makes more sense and you use a lot fewer lines of code to do the same thing as in C++... Like with the TansparentStati c text... C#
already takes care of that automatically (your class saved my neck on a
deadline though for C++!).

The controls look a lot better.

Version control should be a lot better with the OneClick development
(compared to our current method).

Office automation (what a nightmare) is supposed to be easier and I have
been finding more documentation for it than with C++. ... Actually I have
found more examples with VB.NET which I think we can still incorperate in our C# code (not sure how that works yet).

From what I have read there is supposed to be more consistancy accross OS's using C# (or just .NET in general) since it is the same framework. I know we have had problems in the past between differnt Windows versions with some of the software we write in C++.

Sockets are supposed to be easier according to my comrade in the next room. He said something about SSL being built in to the .NET framework whereas we are having to use a 3rd party library for it in C++.

Alot of these things are just projections and things I have been told to be true... and with the little programming I have done so far, a lot of it
checks out. I am not a pro though (entry level, small company). Pleaes
don't hold me responsible for these comments if they are in error... these
are the preconceptions I have about it from what I have read, etc... Can any one confirm these comments?

Rob K
"AliR" wrote:
Hi All,

The question is why should I use C#?
If am developing a windows application, what are the advantages of using C# versus VC++ (MFC)?
Thanks
AliR.

Nov 23 '05 #7
"AliR" <Al**@online.no spam> wrote in message
news:fU******** **********@news svr11.news.prod igy.com...
What I have noticed so far is that it is easy to develop
simple dialog base applications (I don't deny that), but it seems very
difficult when it comes to MDI applications. Specially in regards to
Docking
windows, menu/toolbar management.
I can't compare C# with C++, but it's my experience that WinForms C# is
vastly superior to VB6 when it comes to MDI apps. I reckon I can develop an
MDI app in C# in approximately a third of the time it would take me in VB6.
I also find it's event handling a bit convoluted. It's just not easy to
read,
and know what events are being handled and which ones aren't.


Again, that's not my experience at all. I really like the C# events,
especially when used in conjunction with ASP.NET and all the event bubbling
that goes on there...
Nov 23 '05 #8
I suspect that once you've done it for a while, you'll find that C# is
actually far easier than C++. Docking is pretty simple and I doubt MDI apps
are going to be all that difficult either, though in all honesty, I haven't
done an MDI app yet.

I did C++ for years and I liked it for the power it gave me. But I switched
to C# and after 3 years, I can't even imagine going back to C++. I've had to
for a few things and each time I've found it painful. Dealing with strings,
all the memory management (not that it's completely gone in C#, but it's
MUCH easier).

In C#, I can be 4 to 5 times as productive as in C++.

When it comes down to it, that's the only reason I need. It makes me far
more productive.

Pete

"AliR" <Al**@online.no spam> wrote in message
news:fU******** **********@news svr11.news.prod igy.com...
Hi Rob,

I am glad the Transparent Static class helped you out. :)

The reason I asked this question here is that, for the past year every
time
I talk to a headhunter about jobs they tell me that they haven't ran into
a
C++ job in a while, and all the companies that they deal with want C#
programmers.
I have read a book on C# (Teach yourself in 21 days, got it free from
codeguru for my Transparent Listbox), and I am reading the Wrox Beginner
C#
.net 2005 now. What I have noticed so far is that it is easy to develop
simple dialog base applications (I don't deny that), but it seems very
difficult when it comes to MDI applications. Specially in regards to
Docking
windows, menu/toolbar management. I also find it's event handling a bit
convoluted. It's just not easy to read, and know what events are being
handled and which ones aren't.

So the reason I asked this question here is that I wanted to know why
people
prefer C# over C++. I don't have enough expirence with C# to make a good
judgment about the language, but from what I have seen so far I find MFC
easier to deal with, and alot more flexiable than C#. So I wanted to find
out from people who actually use C# what they find like about it.

AliR.
"RobKinney1 " <Ro********@dis cussions.micros oft.com> wrote in message
news:CD******** *************** ***********@mic rosoft.com...
Hello AliR,

(usually I see you in the C++ sections!) Our company has decided to go

with
C# for our new devlopment for a few reasons (we still use C++ on a ddaily
basis).

It just works. It makes more sense and you use a lot fewer lines of code

to
do the same thing as in C++... Like with the TansparentStati c text... C#
already takes care of that automatically (your class saved my neck on a
deadline though for C++!).

The controls look a lot better.

Version control should be a lot better with the OneClick development
(compared to our current method).

Office automation (what a nightmare) is supposed to be easier and I have
been finding more documentation for it than with C++. ... Actually I
have
found more examples with VB.NET which I think we can still incorperate in

our
C# code (not sure how that works yet).

From what I have read there is supposed to be more consistancy accross

OS's
using C# (or just .NET in general) since it is the same framework. I
know

we
have had problems in the past between differnt Windows versions with some

of
the software we write in C++.

Sockets are supposed to be easier according to my comrade in the next

room.
He said something about SSL being built in to the .NET framework whereas

we
are having to use a 3rd party library for it in C++.

Alot of these things are just projections and things I have been told to

be
true... and with the little programming I have done so far, a lot of it
checks out. I am not a pro though (entry level, small company). Pleaes
don't hold me responsible for these comments if they are in error...
these
are the preconceptions I have about it from what I have read, etc... Can

any
one confirm these comments?

Rob K
"AliR" wrote:
> Hi All,
>
> The question is why should I use C#?
> If am developing a windows application, what are the advantages of
> using C# > versus VC++ (MFC)?
>
>
> Thanks
> AliR.
>
>
>


Nov 23 '05 #9
AliR... If you are a C++ programmer there is no need to change languages
with c++/cli. Just target the .NET framework in C++/cli and call native
code using ItJustWorksInte rop.

In the following C++/cli code demonstrating Resource Acquisition Is
Initialization, the destructor will be called when r goes out of scope.
This is an exception safe guarantee.

RAII r;
r.SayHello();
Console::WriteL ine(r.I);

Here is C++/cli syntax that a C# programmer should be able to read:

public ref class RAII
{
private:
int i;
bool isDeleted;
public:
RAII() : i(2), isDeleted(false )
{
Console::WriteL ine(L"Construct or called.");
}
~RAII() // maps to Dispose
{
if (!isDeleted) { // release once only
// clean up managed resources here.
Console::WriteL ine(L"Releasing managed resources.");
this->!RAII(); // clean up unmanaged resources here.
}
this->isDeleted= true;
Console::WriteL ine(L"Destructo r called.");
// finalize (!RAII) is automagically suppressed
};
!RAII() // maps to Finalize
{
if (!isDeleted)
{
// Clean up unmanaged resources here.
Console::WriteL ine(L"Releasing unmanged resources.");
}
Console::WriteL ine(L"Finalizer called.");
}
property int I {
void set(int value) {this->i = value;}
int get() {return i;}
}
// this can be called even after this object has been disposed!
// ASSERT isDeleted is false
void SayHello()
{
if (isDeleted) {
throw gcnew System::Invalid OperationExcept ion();
}
Console::WriteL ine(L"Hello");
}
void Close() {
if (!isDeleted) {
this->~RAII();
}
}
};

Here is a native C++ class with only a managed entry point:

public class Native {
public:
virtual int __clrcall Sum(int ai[], int size) {
int sum=0;
for(int i=0; i< size; i++) {
sum+= ai[i];
}
return sum;
}
};

Here is ItJustWorksInte rop:

int SumInteropClrCa ll(array<int>^ ai) {
pin_ptr<int> ppi= &ai[0];
Native n;
return n.Sum(ppi,ai->Length);
}
Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11207
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL) on the server because of that. Our site will have an SSL certificate next week, so I would like to use AIM instead of SIM, however, I don't know how to send data via POST over https and recieve data from the Authorize.net server over an https...
2
5802
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues to execute the code until the browser send his reply to the header instruction. So an exit(); after each redirection won't hurt at all
3
22995
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which field is completed.
0
8460
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. 354 roberto@ausone:Build/php-4.3.2> ldd /opt/php4/bin/php libsablot.so.0 => /usr/local/lib/libsablot.so.0 libstdc++.so.5 => /usr/local/lib/libstdc++.so.5 libm.so.1 => /usr/lib/libm.so.1
1
8564
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one column fills. If the viewer selects two states, two columns fill. Etc. I could, if appropriate, have...
4
18253
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the user comes back to a page where he had a submitted POST data the browser keeps telling that the data has expired and asks if repost. How to avoid that? I tried registering all POST and GET vars as SESSION vars but
1
6810
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url http://www.mis.gla.ac.uk/biquery/training/ but each of the courses held have maximum of 8 people that could be
2
31394
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value to :parameter I dont like the idea of making the SQL statement on the fly without binding parameters as I dont want a highly polluted SQL cache.
3
23564
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the results of the picture half the size. The PHP I have installed support 1.62 or higher. And all I would like to do is take and image and make it fit a 3x3. Any suggestions to where I should read or look would be appreciated.
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.