1 / 10

Common Type System

Common Type System. A chic type, a rough type, an odd type - but never a stereotype Jean-Michel Jarre. Review & Context. Types are defined by CLR, hence it is same across languages Two phases of .Net learning Basics – CLR, types, Language syntax VB.Net or C#

bluma
Download Presentation

Common Type System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Common Type System • A chic type, a rough type, an odd type - but never a stereotype • Jean-Michel Jarre More Types & C#

  2. Review & Context • Types are defined by CLR, hence it is same across languages • Two phases of .Net learning • Basics – CLR, types, Language syntax VB.Net or C# • Application – ADO.Net, ASP.Net, Windows Forms. More Types & C#

  3. What is a Type? • The CTS provides every language running on the .NET platform with a base set of data types • Two Categories • Value Types: Value types directly contain their data. • Reference Types: Reference types store a reference to the value's memory address More Types & C#

  4. Reference Vs. Value type int x = 10; Employee e1, e2; e1 = new Employee ("John Smith", 25, 30000); e2 = e1; x e1 “John Smith” 25 30,000 10 e2 More Types & C#

  5. CTS More Types & C#

  6. Built-in Value Types • Integers, floating point, Logical etc. • Refer to the table in the following page More Types & C#

  7. Category Class name Description Visual Basic data type C# data type Integer Byte An 8-bit unsigned integer. Byte byte SByte An 8-bit signed integer. Not CLS-compliant. SByte No built-in type. sbyte Int16 A 16-bit signed integer. Short short Int32 A 32-bit signed integer. Integer int Int64 A 64-bit signed integer. Long long UInt16 A 16-bit unsigned integer. Not CLS-compliant. UInt16 No built-in type. ushort UInt32 A 32-bit unsigned integer. Not CLS-compliant. UInt32 No built-in type. uint UInt64 A 64-bit unsigned integer. Not CLS-compliant. UInt64 No built-in type. ulong More Types & C#

  8. Category Class name Description Visual Basic data type C# data type Floating point Single A single-precision (32-bit) floating-point number. Single float Double A double-precision (64-bit) floating-point number. Double double Logical Boolean A Boolean value (true or false). Boolean bool Other Char A Unicode (16-bit) character. Char char Decimal A 96-bit decimal value. Decimal decimal Class objects Object The root of the object hierarchy. Object object String An immutable, fixed-length string of Unicode characters. String string More Types & C#

  9. Exercise • For all the integer types find the maximum and minimum possible values. • E.g. for byte the max value is 255 • Hint: Refer to the documentation on base types such as System.Byte, System.Int32 • Use System.Convert class to convert between types. • What is Type Casting? More Types & C#

  10. Type Members • Events • Field • Method • Property More Types & C#

More Related