Introduction to C# — презентация
logo
Introduction to C#
  • Introduction to C#
  • What is.NET?
  • What is the CLR ( Common language runtime )?
  • Meaning of CLR
  • IL  (Intermediate Language)
  • Metadata
  • How work JIT ( Just-in-time compilation )?
  • How work JIT?
  • What is the CTS ( Common Type System )?
  • What is the CTS?
  • What is the CLS?
  • What is the CLS?
  • The Class Libraries
  • Assemblies
  • COM vs.NET
  • ASP.NET and ADO.NET
  • Windows PowerShell
  • First C# Program
  • Constructions of Note
  • Constructions of Note
  • More C# : basic inheritance
1/21

Первый слайд презентации: Introduction to C#

Изображение слайда

Слайд 2: What is.NET?

Runtime Operating System .NET Framework Common Type System Common Language Runtime Building Blocks (e.g. for Services) Services:.NET and COM+ SQL Server BizTalk ... Languages : C#, Visual Basic, etc .NET Applications Enterprise Servers ... Sharepoint ... Web Services

Изображение слайда

Class Loader MSIL to Native Compilers (JIT) Code Manager Garbage Collector (GC) Security Engine Debug Engine Type Checker Exception Manager Thread Support COM Marshaler Base Class Library Support

Изображение слайда

Слайд 4: Meaning of CLR

Ouutput age of object using System; namespace ConsoleApplication_Test_Csharp {   public class SomeClass   {     int age;     public int GetAge()     {       age = 22;       return age;     }   }   public sealed class Program   {             public static void Main()     {       System.Console.Write("My age is ");       SomeClass me = new SomeClass();       int myAge;       myAge = me.GetAge();       System.Console.WriteLine(myAge);       Console.ReadLine();     }       } }

Изображение слайда

Слайд 5: IL  (Intermediate Language)

IL – special lowlevel language (like asm)

Изображение слайда

Слайд 6: Metadata

Data for define objects (in *.exe or *.dll)

Изображение слайда

Analyze of head (32- or 64-bit) Use MSCorEE.dll ( C:\Windows\System32\MSCorEE.dll  for 32 -bit) from MSCorEE.dll initialize CLR, assembly entry point of Main() function of our program static void Main() {   System.Console.WriteLine("Hello ");   System.Console.WriteLine("Goodbye"); }

Изображение слайда

Слайд 8: How work JIT?

Изображение слайда

Слайд 9: What is the CTS ( Common Type System )?

A set of common types any language that runs in CLR should implement no syntax specified Languages often define aliases supports only single inheritance (unlike C ++) all types are inherited from System.Object (Object - type name, root of all other types, System - namespace) For example CTS defines System.Int32 – 4 byte integer C# defines int as an alias of System.Int32

Изображение слайда

Слайд 10: What is the CTS?

From MSDN

Изображение слайда

Слайд 11: What is the CLS?

A specification of language features how methods may be called when constructors are called subset of the types in CTS are allowed For example Code that takes UInt32 in a public method UInt32 is not in the CLS Can mark classes as CLS-compliant not marked is assumed to mean not compliant

Изображение слайда

Слайд 12: What is the CLS?

Изображение слайда

Слайд 13: The Class Libraries

The common classes used in many programs like Java Class Library eg. System.Console.WriteLine XML, Networking, Filesystem, Crypto, containers Can inherit from many of these classes Many languages run on.NET framework C#, C++, J#, Visual Basic even have Python (see IronPython)

Изображение слайда

Слайд 14: Assemblies

Code contained in files called “assemblies” code and metadata .dll as before to run: public static void Main(string[] args) types private: local directory, not accessible by others eg. Wolfram.NETLink shared: well-known location, can be GAC strong names: use crypto for signatures then can add some versioning and trust

Изображение слайда

Слайд 15: COM vs.NET

Historically, COM provided this integration support for interfaces and interaction given a GUID, lookup the type library dynamically instantiate class do RPC to make calls in many cases Difficult to get right software engineering problems not type safe at all

Изображение слайда

Слайд 16: ASP.NET and ADO.NET

Use.NET languages in web pages thus can write typesafe code server-side or client-side Sharepoint interactions can log in Use the CLR to access databases in the manner of ODBC provides classes for access

Изображение слайда

Слайд 17: Windows PowerShell

New shell originally for MS Vista available for WinXP/2k3 native.NET instantiates arbitary.NET classes and accesses them Also can access COM objects Allows better interaction with programs Can it surpass bash and others?

Изображение слайда

Слайд 18: First C# Program

using System; namespace Test { int a = 137; class Hello { public static void Main(string[] args) { Console.WriteLine(“Hello {0}”, a); } } }

Изображение слайда

Слайд 19: Constructions of Note

using like import in Java: bring in namespaces namespace disambiguation of names like Internet hierarchical names and Java naming class like in Java single inheritance up to object

Изображение слайда

Слайд 20: Constructions of Note

Console.Write(Line) Takes a formatted string: “Composite Format” Indexed elements: e.g., {0} can be used multiple times only evaluated once {index [,alignment][:formatting]} also can use as in Java “Test “ + a

Изображение слайда

Последний слайд презентации: Introduction to C#: More C# : basic inheritance

class A { protected int a; public virtual void print() { Console.WriteLine(“a = “ + a); } } class B : A { public override void print() { Console.WriteLine(“a really = “ + (a + 137)); } }

Изображение слайда

Похожие презентации