C# - Is it any good

Started by
34 comments, last by tai_tiger 21 years, 11 months ago
quote:
8) Is there mechanism in vs.net that can examine my code, and tell me if it is CLS compliant?


You can force C# programs to comply with the Common Language Specification (CLS) by using the following attribute at the top of your code (after and using statements):

[assembly:CLSCompliant(true)]

You will be unable to use a few of C#''s helpful features (like operator overloading) but you will guarantee that your class will be accessible by other CLR-compatible languages (like VB.NET etc.)



Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
Advertisement
quote:Original post by Brobanx
1) You can design forms, and it will generate the WinForms code for you... but when you change the code, will it update the forms you designed (I like working on forms both ways)?

No, the forms designer is one way. Stay out of the regions marked as #region Windows Form Designer generated code
quote:
9) Is there source code available for the Class Library?

No. You can use ildasm(the MSIL disassembler) to view the MSIL from the framework assemblies, tho. Its fairly easy to figure out whats going on.
Perhaps they will release the source if enough people keep bugging them about it.
You can also take a look at Rotor[1], which has source code for an implementation of the CLI subset of the .NET framework. According to the docs, the code is derived from the same codebase as the framework.
quote:
12) What are some good reasons to use Managed C++?

Mainly for interop scenarios - you have to deal with an existing C/C++ codebase or you are interacting with a legacy API and find P/Invoke to be too painful. If speed is critical, MC++ may also be a good choice.
quote:
13) and correct me if im wrong... .Net supports compilers for C#, C++ (managed and unmanaged), visual basic, java-script, asp.

ASP is not a language - its a runtime. ASP.NET theoretically supports development in any .NET compliant language, although VS.NET only has support for ASP.NET pages done in C# or VB.NET.

VS.NET has editor and debugger support for JScript.NET(java-script), but you have to invoke the jsc.exe compiler from the command line.
quote:
14) Oh yes, and what exactly is ADO.Net?

The primary database API. The Framework ships with managed providers for SQL Server and OLEDB, and you can download an ODBC provider from MS. I *think* there is an Oracle provider in beta from MS.

I have also seen a couple of projects(some open source) around to create a MySQL managed provider.
quote:
15) Unmanaged C++, you can still compile to native win32 with this, the compiler has been updated and the standard library improved, kudos to ms for that... but, it''s still not completely standards compliant, do you think there will be any attempt made to upgrade their C++ compiler

Yes - they have stated this is likely to happen.
quote:
, and if it happens, will it be a free download?

Thats anyones guess.

[1] - http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/msdn-files/027/001/901/msdncompositedoc.xml

--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
quote:Original post by sjelkjd

2) Can I add my own "keywords" that I want to be highlighted?
Haven't found it yet, if it exists.



its been there since vc 4.0, they just moved in in .net

see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxtskDefiningKeywordsInVisualC.asp

do a search for usertype.dat, and you will see people have them pregenerated for download with everything from MFC, to WIN32, to OpenGL function names and constants. Take your pick.

[edited by - invective on May 8, 2002 8:30:26 PM]
Once again thanxs everyone for there input! I have finally been able to interface with DirectX (using DxVBLibA) so I will write eome speed testing routines in C# and C++ to "See" which performs better. =)



===========TAI================

===========TAI================
Well, I''m glad to report that C# isn''t as slow as it could be, definately outperforms java ATM.
I made my own vector struct in c#, with overloaded operator+,

I instantantiated 15000000 (15 million) vectors to default values, then in a loop I instantiated them again to different values (based on i).

I then added vectors 1-5000000 with vectors 5000001 - 10000000 plus 10000001 - 15000000.

I compiled this code with no optimizations, and it took about one and a half seconds to complete on my 1.3 GHz athlon.

If you know your C#, the code for my program is this...


  using System.Windows.Forms;class VectorTestProgram{  public static void Main() {    MessageBox.Show("Start your engines!");    Vector[] jack = new Vector[15000000];    for(int i = 0; i < 5000000; ++i) {          jack[i] = new Vector(i, 3400, 6500);      jack[i + 5000000] = new Vector(6200, 7843, i);      jack[i + 10000000] = new Vector(23432, i, 9800);            jack[i] = jack[i + 5000000] + jack[i + 10000000];     }        MessageBox.Show("All Done");  }}struct Vector{  private int x, y, z;  public Vector(int a, int b, int c) {    x = a; y = b; z = c;  }    public static Vector operator+ (Vector a, Vector b) {    return new Vector(a.x + b.x, a.y + b.y, a.z + b.z);  }}  
Brobanx - your last post is in direct violation of the .NET Framework EULA
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement