C Paul Stubbs MCSD MCSE 4 0 MCPI
C# Paul Stubbs MCSD, MCSE 4. 0, MCP+I, MCT, MCAD. Net
Agenda o o Language Features Development Environment Performance Total Cost of Ownership (TCO)
Hello World using System; class Hello { static void Main() { Console. Write. Line("Hello world"); } }
. Net Framework VB C++ C# J# … Common Language Specification Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO. NET and XML Base Class Library Common Language Runtime Operating System Visual Studio. NET ASP. NET
Design Goals o Component Oriented n n o Properties, methods, events Design-time and run-time attributes Integrated documentation using XML No header files, IDL, etc. Everything is an Object
Design Goals o Garbage Collection n o Versioning n o Built into the framework Exceptions n o No memory leaks Baked into the language and framework Type Safe n No unsafe casts
Design Goals o Multi-Platform n o Rotor n o Free. BSD Mono n o Win 32 , Win 64 GNU/Linux , Unix, Mac OS X, Solaris Multi-Language n Over 20 languages supported
Interoperability o o No need to rewrite everything Interop with COM+, XML, SOAP, DLL and other. Net assemblies Use. Net assemblies from COM C++ n n n Pointers (in unsafe code) Unsigned integers Can only be run from Fully. Trusted code
C# only o Delegates n n n Provide callbacks Eventing model Type safe function pointers Multicast Asynchronous
C# only o Enumerations n n o Group together user defined constants Type Safe Structs (value types) n n n Created on the stack Passed by value No need to garbage collect
C# only o Foreach n n Iterate through arrays, collections and classes Consistent and concise String[] months = {“Jan”, ”Feb”, ”Mar”, ”Apr”, ”May”}; Foreach{string month in months} Console. Write. Line(“The month is “ + month);
C# only o Properties n n n Accessed as if it were a field Same as getter and setter pattern Maintains relationship between get and set Java/C++ C# Foo. set. Size(get. Size() + 1); Label. get. Font(). set. Bold(true); Foo. size++; Label. font. bold = true;
C# only o o o Preprocessor Directives Runtime code generation Pass by reference Variable length parameter lists Explicit Interface Implementation
Development Tools o Visual Studio. Net n n n n Rich Client development Web Client development Mobile Client (WAP) development Windows CE (Pocket. PC) development Office 11 (soon) development XML/XSL development Integrated Source Control
Visual Studio. NET
Performance / Pet Shop
Maintainability / Pet Shop
Affordability o o Windows on Intel delivers more bang for the buck than the Mainframe or UNIX-based servers Visual Studio. NET n n n Less code End to End Debugging XCOPY deployment Integrate existing code Use existing developers skills
Summary o o o C# and Java are very similar Power of C++ simplicity of VB C# is a standard n o o o ECMA-334 C#, ECMA-335 CLI, ISO Robust Development Environment High Performance Lower cost
Links o Maine. Bytes. Net User Group n o Pet Shop benchmark test n o http: //www. Maine. Bytes. com http: //www. middlewarecompany. com/j 2 eedotnetbench/ Comparison of C# and Java n http: //www. 25 hoursaday. com/Csharp. Vs. J ava. html (80 page white paper)
Links o Mono n o http: //www. go-mono. com Rotor n http: //www. corel. com/ssclii/
- Slides: 22