Download presentation
Presentation is loading. Please wait.
1
Introduction to C# AKEEL AHMED
2
What is .NET? A Framework in which to run code
A Common Language Runtime (CLR) runs all programs C# compiles to Microsoft Intermediate Language MSIL runs on CLR Virtual Machine like Java code written in many languages compiles to MSIL A Common Language Specification (CLS) A Common Type System (CTS)
3
Building Blocks (e.g. for Services)
What is .NET? Runtime Operating System .NET Framework Common Type System Language 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 From MSDN
4
Base Class Library Support
What is the CLR? 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 From MSDN
5
What is the CTS? A set of common types For example
any language that runs in CLR should implement no syntax specified Languages often define aliases For example CTS defines System.Int32 – 4 byte integer C# defines int as an alias of System.Int32
6
What is the CTS? From MSDN
7
What is the CLS? A specification of language features For example
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
8
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)
9
Assemblies Code contained in files called “assemblies”
code and metadata .dll( daynamic link library) 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 strong names: use crypto for signatures then can add some versioning and trust
10
First C# Program using System; namespace Test { int a = 137;
class Hello { public static void Main(string[] args) { Console.WriteLine(“Hello {0}”, a); } } }
11
Constructions of Note using namespace class
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
12
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.