473,508 Members | 2,079 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 1163
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.com

"AliR" <Al**@online.nospam> wrote in message
news:cG******************@newssvr25.news.prodigy.n et...
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.nospam> wrote in message
news:cG******************@newssvr25.news.prodigy.n et...
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...which 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 TansparentStatic 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********@discussions.microsoft.com> wrote in message
news:CD**********************************@microsof t.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 TansparentStatic 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.nospam> wrote in message
news:fU******************@newssvr11.news.prodigy.c om...
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.nospam> wrote in message
news:fU******************@newssvr11.news.prodigy.c om...
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********@discussions.microsoft.com> wrote in message
news:CD**********************************@microsof t.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 TansparentStatic 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 ItJustWorksInterop.

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::WriteLine(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::WriteLine(L"Constructor called.");
}
~RAII() // maps to Dispose
{
if (!isDeleted) { // release once only
// clean up managed resources here.
Console::WriteLine(L"Releasing managed resources.");
this->!RAII(); // clean up unmanaged resources here.
}
this->isDeleted= true;
Console::WriteLine(L"Destructor called.");
// finalize (!RAII) is automagically suppressed
};
!RAII() // maps to Finalize
{
if (!isDeleted)
{
// Clean up unmanaged resources here.
Console::WriteLine(L"Releasing unmanged resources.");
}
Console::WriteLine(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::InvalidOperationException();
}
Console::WriteLine(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 ItJustWorksInterop:

int SumInteropClrCall(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
"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:zL******************************@giganews.com ...
When it comes down to it, that's the only reason I need. It makes me far
more productive.


Yeah - that's pretty much the bottom line...
Nov 23 '05 #11
> 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 work in both C++/C# and also still use MFC, but I am happy that I do not
have to rely on MFC anymore and I am busy phasing out that MFC part.
C# has a much more clear syntax than C++ so you have less bugs and it also
compiles much faster.

The good news is that C# comes very close to C++, so it is not that hard to
learn C#.
I love programming in C#.

But it is up to you to decide what you want to program in.
VB.NET/C# and C++/CLI are different syntaxes but creates the same functional
program.
Nov 23 '05 #12
And I have to add, with C# no more linker errors like you get in C++ where
you sometimes need a few days to discover why the hell you get these
hunderds of compiler errors and why it occurs.
Nov 23 '05 #13

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

Similar topics

3
11177
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)...
2
5773
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...
3
22957
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...
0
8433
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. ...
1
8535
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...
4
18214
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...
1
6776
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 ...
2
31341
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...
3
23531
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...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7328
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,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
4709
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...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
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...

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.