net tech talk series

Download NET Tech Talk Series

If you can't read please download the document

Upload: haley

Post on 07-Jan-2016

23 views

Category:

Documents


0 download

DESCRIPTION

.NET Tech Talk Series. Intro to C#. Wednesday, February 5 th , 2003. Michael Dunn ( [email protected] ) Drexel University Student Ambassador to Microsoft Mid-Atlantic Student Ambassador Team Lead MCS Society Vice President. Agenda. Introduction What is C#? A first look at C# Code demo - PowerPoint PPT Presentation

TRANSCRIPT

  • .NET Tech Talk SeriesWednesday, February 5th, 2003Intro to C#Michael Dunn ( [email protected] )

    Drexel University Student Ambassador to MicrosoftMid-Atlantic Student Ambassador Team LeadMCS Society Vice President

  • AgendaIntroductionWhat is C#?A first look at C#Code demoC# featuresConclusionQuestionsRaffle

  • IntroductionThird in a series of .NET Technical Talks sponsored by Microsoft and Drexels Math and Computer Science Society.Summary of last talk:Keep your old C++ code, and inter-operate with .NET using C++.NET to get access to the class library, security, and garbage collection.As usual:Please remember to fill out evaluations you cant win a door prize without a completed formPlease hold detailed questions till the end

  • What is C#?A new object oriented language Syntax based on C Similar to C++ and Java Used to write .NET software Software that targets the .NET Framework is called managed code C# gains much from the .NET Framework Internet oriented platform JIT compilation Automatic memory management Security, type-safety Framework Class Library

  • What is C#?Existing languages are powerful. Why do we need another language?Important features are spread out over multiple languageschoose between pointers (C++) or garbage collection (Java)Old languages + new features = poor syntaxGarbage collection in C++?Event-driven GUIs in Java?

  • What is C#?Derived from the features and syntaxes of other languagesThe safety of JavaThe ease of Visual BasicThe power of C++

  • What is C#?The safety of Java100% object orientedAutomatic garbage collectionArray bounds checking at runtimeStrict type checkingStructured exception handling

  • What is C#?The ease of Visual BasicFirst class support for propertiesFirst class support for eventsFor-each loops

  • What is C#?The power of C++EnumerationsOperator overloadingMathematical, Indexing, and CastingFunction pointersCalled delegatesType safeStructsOption to pass parameters by reference of by valueCan disable type-safety, garbage collection, and bounds checkingCan directly manipulate memory with pointers

  • A first look at C#using System.Windows.Forms; using System.Drawing; class MyForm:Form { public static void Main() { Application.Run(new MyForm()); } protected override void OnPaint(PaintEventArgs e){ e.Graphics.DrawString("Hello World!", new Font("Arial", 35), Brushes.Blue, 10, 100); } }

  • Code demo

  • What is C#?Most users think of two types of objectsReal objects Customer, Order, etc.Primitive types int, float, boolDifferent expectations for eachReal objects are more expensive to createPrimitives always have a valuePrimitives have operator support

  • What is C#?Traditional viewsC++, Java: Primitive types are magic and do not interoperate with objectsC# offers improved extensibility and reusabilityNew primitive types: Decimal, SQL, Collections, etc., work for all types

  • What is C#?Unified type systemAll types ultimately inherit from objectClasses, enums, arrays, delegates, structs, An implicit conversion exists from any type to type object

  • What is C#?76 keywords:

    abstractasbaseboolbreakbytecasecatchcharchecked classconstcontinuedecimaldefaultdelegate dodoubleelseenumeventexplicitexternfalsefinallyfixedfloatforforeachgotoIfimplicitinintinterfaceinternalislocklongnamespacenewnullobjectoperatoroutoverrideparamsprivateprotectedpublicreadonlyrefreturnsbytesealedshortsizeofstackallocstaticstringstructswitchthisthrowtruetrytypeofuintulonguncheckedunsafeushortusingvirtualvoidwhile

  • C++.NET primer (cont.)Source CodeCompilationCode (IL)MetadataExecutionJIT CompilerNativeCode

  • C++.NET primerC++.NET is _not_ a dramatically different language from your daddys C++Everett C++.NET will be 98% compliant with the ISO standardEverett will ship with /GS compiler flag to catch buffer overflowsThe syntax generally remains the same, while the compiler emits entirely different instructionsDue to Intermediate Language (IL), machine instructions are generated at runtime

  • C++.NET primerWhy use C++.NET over C#, or other .NET languagesUse managed or unmanaged codeKeep using your low-level or performance critical native code alongside .NETLots of code already written in C++/clr compiler switch IJW (It Just Works)Use cross-language debugging and all the other neat .NET tricks

  • C++.NET demoLive demo of C++.NET with Visual Studio.NET 2002

  • ConclusionsC++.NET targets the same lower-level developers as Visual C++ 6.Compile your old C++ code using the C++.NET compiler to get the advantages of .NET.Moving toward ISO standardization

  • Next tech talkNext week, Wednesday!Same time, same placeTopic: Intro to C#More books, software and food

  • Further references

    http://www.gotdotnet.com/team/cplusplus/http://msdn.microsoft.com/visualc/http://www.cplusplus.com/

  • Questions / RaffleSend your evaluations forward!