What belongs in C# and what doesn't? 
Author Message
 What belongs in C# and what doesn't?

Hello,

My primary experience is in C, C++, Win32, and MFC.  I'm trying to get into
C# but I must be missing something somewhere.  When trying to write an
application in C# I find myself at a loss in some cases as to whether I
should use an old Win32 API, an MFC method, or if some C# method exists to
replace the previous way of doing things.  For example, according to Petzold
Microsoft either accidentally or intentionally omitted the ScrollWindow
method so he uses the Win32 call instead, admitting that to do so is a
kluge.

For example my program needs to look through all files and directories.  In
the past I've used the MFC FindFile and FindNextFile methods or simply the
Windows _findfirst and _findnext functions.  I assume that to be a true
managable C# application certian functions should be used and others
shouldn't.  How can I differentiate?  Apparently there are simply some
things that cannot be done in C# without resorting to some of the code of
yesteryear.  I had hoped that when I did an online search using the help
feature of the Visual C# IDE that I would be able to find those things that
were exclusively C# but I instead get help on all of the old stuff as well
as C# itself.  Has anyone made a list of those things that are simply
impossible to do using C# only (i.e., window scrolling(done the right way),
multimedia, etc.)?  A similar list of what C# methods have replaced the old
ways of doing things would be very helpful.

Thanks,
Ray Mitchell



Thu, 30 Dec 2004 15:19:51 GMT  
 What belongs in C# and what doesn't?
First please note, C# is a programming SYNTAX only,
check this keywords
  http://msdn.microsoft.com/library/en-us/csref/html/vclrfCSharpKeyword...

All classes are part of the .NET Framework
and are usable from any .NET language like VB.NET ...

So it is STRONGLY recommended to LEARN the .NET classes!
I guess most people will only need 5% of
the learning time for C# itself, but 95% to
get a good knowledge of the .NET framework design and classes.

Sometimes it is best to just forget how it worked in MFC/C++.
.NET is a new generation, and many things work different.

Unfortunately, MS didn't publish a list of
 - WIN32 to .NET
 - MFC   to .NET
porting guidelines, the only I know is for C-Runtime:
  http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q313836

.NET is 'platform independent', so many Windows specific
problems can only be solved using Interop/PInvoke.
But we can expect .NET to support much more with every new release.
Please use PInvoke only if you are 100% sure there
is no .NET solution for the same.
 (you could ask in the .NET newsgroups)

For many Windows Forms issues, also read:
  http://www.syncfusion.com/FAQ/winforms/

--
  NETMaster  (Thomas Scheidegger)
  http://www.cetus-links.org/oo_csharp.html

Quote:

> My primary experience is in C, C++, Win32, and MFC.  I'm trying to get into
> C# but I must be missing something somewhere.  When trying to write an
> application in C# I find myself at a loss in some cases as to whether I
> should use an old Win32 API, an MFC method, or if some C# method exists to
> replace the previous way of doing things.  For example, according to Petzold
> Microsoft either accidentally or intentionally omitted the ScrollWindow
> method so he uses the Win32 call instead, admitting that to do so is a
> kluge.



Thu, 30 Dec 2004 16:34:44 GMT  
 What belongs in C# and what doesn't?
C# is not a replacement for anything; not C++,
not MFC, not VCL, not STL, not ATL, etc.  It is an
entirely different approach to writing window applications.

I view C# as nothing more than the glue used to tie
together a huge set of classes.  So, I think of C#
as being more a very large class library than a
language.  Learning the syntax of C# is relatively
easy.   Learning how to effectively used the class
library is not so easy; especially when you get into
data access and file access.  But, it provides a
higher level of abstraction.

The library provides a File Stream class that supports
the processing of Directories and Files.  

To learn C#, one has to know the libraries (the DotNet
Framework).  If your needs can be satisfied with one
of the DotNet classes, use the class.  Otherwise, you
will have to look at Interop (classic COM), or
unmanaged C++.  Write a recursive directory routine in
C++ and then write the same functionality using the
Directory Class in DotNet and you will appreciate what
DotNet brings to the table -- not raw speed; but
better programmer productivity, improved syntax checking,
improved debugging, and easy of maintenance.

One thing that is a real asset is the amount of C#
source code available in the public domain.  From the
Msft samples (Duwamish, Pet Shop, F$M Stocks, etc.)
to stuff like Sharp Develop, they provide insights into
how to use effectively use the DotNet classes.  See
http;//www.gotdotnet.com and http://www.icsharpcode.com.

Jim H.



Sun, 02 Jan 2005 08:06:04 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Visuals C# .NET Standard Edition doesn't include Class Library Project Template

2. why C# doesn't support late-binding?

3. Why C# doesn't have default parameter?

4. C# doesn't seem to install ?

5. Manipulating windows belonging to other programs (that I didn't write)

6. what files don't belong in sourcesafe?

7. program doesn't see '\0'

8. IO performance C# Versus C++ (For C# GURU's only)

9. ATL Controlcontainer doesn't follow VB's Screen.MousePointer

10. Calling ADO's GetRows() from VC doesn't work

11. Don't know why this doesn't work, but

12. TERMWAIT Win 3.1 sample doesn't work under '95

 

 
Powered by phpBB® Forum Software