... experience directly informed C+ +/CLI xxiii Hogenson_705-2FRONT.fm Page xxiv Saturday, October 28 , 20 06 7 :24 PM 0caa2832af4d32f2887b7e4351ab0f49 Hogenson_705-2FRONT.fm Page xxv Saturday, October 28 , 20 06 ... on COM/DCOM, CORBA, and the NET Framework at numerous events, including ECOOP 20 04, OOPSLA 20 03, OOPSLA 20 02, SIGCSE 20 02, and the Microsoft Research Faculty Summit 20 01 xxvii Hogenson_705-2FRONT.fm ... Friday, October 13, 20 06 2: 11 PM CHAPTER ■■■ Introducing C+ +/CLI T his chapter introduces the C+ +/CLI language extensions to C+ + and shows you the classic “Hello, World” example in C+ +/CLI You’ll...
... 22 4 12. 2 Array creation 22 4 12. 3 Array element access 22 4 12. 4 Array members 22 4 12. 5 Array covariance 22 4 Copyright Microsoft ... representing a character of classes Mn or Mcdecimal-digitcharacter: A Unicode character of the class Nd A unicode-character-escape-sequence representing a character of the class Nd underscore-character: ... unicode-character-escape-sequence representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl combining-character: A Unicode character of classes Mn or Mc A unicode-character-escape-sequence...
... Pronounce these words by your self September November primary chemistry algebra engineer December October physical politics statistics volunteer careful cinema computing academic secondary entertain ... difficult 9…… calculations can be done very quickly on computers 10…… NOW, CHECK! A The world’s first electronic computer was built 1……… by the university of Pennsylvania in 1946 However, computers ... entertain NOW, CHECK ! Sep’tember No’vember ‘primary ‘chemistry ‘algebra ,engi’neer De’cember Oc’tober ‘physical ‘politics ‘optional ,volun’teer ‘careful ‘cinema com’puting ‘nursery ‘secondary enter’tain...
... or Nl combining-character: A Unicode character of classes Mn or Mc A unicode-character-escape-sequence representing a character of classes Mn or Mc decimal-digitcharacter: A Unicode character ... character-literal: ' character ' character: single-character simple-escape-sequence hexadecimal-escape-sequence unicode-character-escape-sequence single-character: Any character except ' (U+0 027 ), \ (U+00 5C) , ... of the class Nd A unicode-character-escape-sequence representing a character of the class Nd underscore-character: A Unicode character of the class Pc A unicode-character-escape-sequence representing...
... val2 = false; char Character type; a char value is a Unicode character char val = 'h'; decimal Precise decimal type with 28 significant digits decimal val = 1 .23 M; val1 val2 val3 val4 = = = = 12; ... Green } class Shape { public void Fill(Color color) { switch(color) { case Color.Red: break; 32 Copyright Microsoft Corporation 1999 -20 02 All Rights Reserved Chapter 1Introduction case Color.Blue: ... Console.WriteLine("Instance constructor"); } ~MyClass() { Console.WriteLine("Destructor"); } 18 Copyright Microsoft Corporation 1999 -20 02 All Rights Reserved Chapter 1Introduction public const int MyConst = 12; ...
... 27 1 17 .2. 2 The new modifier 27 2 17 .2. 3 Access modifiers 27 2 17 .2. 4 Constituent types 27 2 17 .2. 5 Static and instance members 27 2 ix C# ... and collections CLI — Common Language Infrastructure CLS — Common Language Specification IEC — the International Electrotechnical Commission IEEE — the Institute of Electrical and Electronics ... 26 4 17.1.1 .2 Sealed classes 26 4 17.1.1.3 Static classes 26 4 17.1 .2 Class base specification 26 5 17.1 .2. 1 Base classes 26 6 17.1 .2. 2...
... the three commands cc -c x .c cc -c y .c cc -c y .c would compile x .c, y .c, and z .c and create object files x.o, y.o, and z.o Then, the three object files could be linked together using cc -o myprog ... the Microsoft C compiler comes with a CL (``compile and link'') command, which works almost the same as Unix cc You can compile and link in one step: cl hello .c or you can compile only: cl /c hello .c ... separate source files, x .c, y .c, and z .c We could compile all three of them, and link them together, all at once, with the command cc -o myprog x .c y .c z .c Alternatively, we could compile them...
... this code is executed Example: private dynamic TrungBinh(dynamic s1, dynamic s2) { return (s1 + s2) / 2; } private void button1_Click(object sender, EventArgs e) { dynamic tb = TrungBinh (2, 4); ... Extension methods: Example public static class myString { public static bool EqualsIgnoreCase ( this string s1, string s2 ) { return s1.Equals(s2, StringComparison.OrdinalIgnoreCase); } } string s = ... Slide Dynamic type dynamic myDynamicVar; Regardless of the value that myDynamicVar actually contains, this code will compile If the requested member does not exist, you will get an exception...
... semicolon (;) 11 Basic concepts in C# (cont.) • Namespace (p.51) • Namespaces are used as a means of categorizing items • Within a namespace, you can declare: • • • • • • another namespace class ... class interface struct enum delegate • C# is case sensitive 12 Console Application (try it out p.18) • Basic Console Application structure using System; using System.Collections.Generic; using System.Linq; ... is C# ? • C# is one of the languages included in the NET Framework – C# is an object-oriented programming language • Applications you can write with C# – – – – Windows applications Web applications...
... representing a character of classes Mn or Mcdecimal-digitcharacter: A Unicode character of the class Nd A unicode-character-escape-sequence representing a character of the class Nd underscore-character: ... unicode-character-escape-sequence representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl combining-character: A Unicode character of classes Mn or Mc A unicode-character-escape-sequence ... identifier-part-character identifier-part-character: letter-character combining-character decimal-digit-character underscore-character letter-character: A Unicode character of classes Lu, Ll,...
... which the declaration occurs 52 Copyright Microsoft Corporation 1999 -20 00 All Rights Reserved Chapter Basic concepts • The scope of a parameter declared in a constructor-declaration is the constructor-initializer ... private declared accessibility Struct members cannot have protected or protected internal declared accessibility • Interface members implicitly have public declared accessibility No access modifiers ... location in which the access takes place is included in the accessibility domain (§3.3 .2) of the member 46 Copyright Microsoft Corporation 1999 -20 00 All Rights Reserved Chapter Basic concepts...
... struct Color { public static readonly Color White = new Color( ); public static readonly Color Black = new Color( ); public Color Complement() { } } class A { public Color Color; // Field Color ... of type Color void F() { Color = Color.Black; Color = Color.Complement(); } } // References Color.Black static member // Invokes Complement() on Color field static void G() { Color c = Color.White; ... overflow checking context 110 Copyright Microsoft Corporation 1999 -20 00 All Rights Reserved Chapter Expressions The overflow checking context can also be controlled through the checked and unchecked...
... * 2; } 8.5 .2 Local constant declarati ons A local-constant-declaration declares one or more local constants local-constant-declaration: const type constant-declarators constant-declarators: constant-declarator ... switch-block switch-block: { switch-sectionsopt } switch-sections: switch-section switch-sections switch-section switch-section: switch-labels statement-list switch-labels: switch-label switch-labels ... = 123 ; int j = 123 ; Console.WriteLine((object)i == (object)j); } } outputs False because the casts create references to two separate instances of boxed int values 126 Copyright Microsoft Corporation...
... specific-catch-clauses: specific-catch-clause specific-catch-clauses specific-catch-clause specific-catch-clause: catch ( class-type identifieropt ) block general-catch-clause: catch block 154 Copyright ... try block catch-clauses try block finally-clause try block catch-clauses finally-clause catch-clauses: specific-catch-clauses general-catch-clauseopt specific-catch-clausesopt general-catch-clause ... considered a match A general catch clause is considered a match for any exception type If a matching catch clause is located: • If the matching catch clause declares an exception variable, the exception...