Course : Introduction to C#

 Course : Introduction to C# 











Course : Introduction to C#














Table of Contents


1.Overview
2.Types
3.Expressions
4.Declarations
5.Statements
6.Classes and Structs
7.Inheritance
8.Interfaces
9.Delegates
10.Exceptions
11.Namespaces and Assemblies
12.Attributes
13.Threads1
4.XML Comments


------------------------------------



Sample of the pdf document 








Class System.String

Can be used as standard type string
string s = "Alfonso";

Note
•Strings are immutable (use StringBuilderif you want to modify strings)
•Can be concatenated with +: "Don " + s
•Can be indexed: s[i]
•String length: s.Length
•Strings are reference types => reference semantics in assignments
•but their values can be compared with ==and !=: if (s == "Alfonso") ...
•Class Stringdefines many useful operations:
CompareTo, IndexOf, StartsWith, Substring, ...


Structs

Declaration
structPoint
 {public int x, y;// fieldspublic Point (int x, int y) { this.x = x; this.y = y; }// constructorpublic void MoveTo (int a, int b) { x = a; y = b; }// methods}
Use
Point p = new Point(3, 4);// constructor initializes object on the stackp.MoveTo(10, 20);// method call..........










Course : Introduction to C#










 Course : Introduction to C# 


0 commentaires: