C# is a multi-paradigm programming language developed by Microsoft, designed for object-oriented and component-oriented programming, with features that support strong design principles. It includes type safety, managed memory, and a unified type system, allowing for easy software component development and integration with various data sources. C# applications can be developed for Win forms, console applications, and websites using ASP.NET.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views15 pages
1.introduction To C#
C# is a multi-paradigm programming language developed by Microsoft, designed for object-oriented and component-oriented programming, with features that support strong design principles. It includes type safety, managed memory, and a unified type system, allowing for easy software component development and integration with various data sources. C# applications can be developed for Win forms, console applications, and websites using ASP.NET.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15
INTRODUCTION TO C#
• C# is a multi-paradigm programming language
which is based on object oriented and component-oriented programming. • It provides a framework for free intermixing constructs from different languages. • C# was developed by Microsoft with Anders Hejlsberg the principal designer and lead architect • Anders Hejlsberg and his team wanted to build a new programming language that would help to write class libraries in a .NET framework. • C# has controversially been stated as an imitation of Java. • both Java and C# have exhibited distinct features which support strong object-oriented design principles. • C# was intended to be a simple, modern, object-oriented language. • C# makes it easy to develop software components through the following: • Encapsulated method signatures called delegates. • Properties, which access private member variables. • Attributes, which provide declarative metadata about types at run time. • Inline XML documentation comments. • Language-Integrated Query (LINQ) which provides built-in query capabilities across a variety of data sources. FEATURES
• C# is the first “component-oriented” language
in the C/C++ family. • The big idea of C# is that everything is an object. • C# is a programming language that directly reflects the underlying Common Language Infrastructure (CLI). • Type-safety: C# is more type safe than C++. Type safety is the extent to which a programming language discourages or prevents type errors. • C#, like C++, but unlike Java, supports operator overloading. • Managed memory is automatically garbage collected. • In addition to the try...catch construct to handle exceptions, C# has a try...finally construct to guarantee execution of the code in the finally block, whether an exception occurs or not. • C# supports a strict Boolean data type • Multiple inheritance is not supported, although a class can implement any number of interfaces. • Unlike Java, C# does not have checked exceptions. • Structs in C# are designed to encapsulate lightweight objects. They are value types (not reference types), so they're passed by value. • There is no access modifier on the name of the base class and inheritance is always public. • ii. A class can only be derived from one base class. If no base class is explicitly specified, then the class will automatically be derived from System. Object. • iii. • In C++, the only types of class members are variables, functions, constructors, destructors and operator overloads, C# also permits delegates, events and properties. • The access modifiers public, private and protected have the same meaning as in C++ but there are two additional access modifiers available: (a) Internal (b) Protected internal (II) • A delegate is similar to a function pointer in C/C#. • Using a delegate allows a programmer to encapsulate a reference to a method inside a delegate object, which can then be passed to code. • In C# one can choose to override a virtual function from base class. • In C# we have abstract methods and in C++ pure virtual methods. Both may not be exactly same • BOXING AND UNBOXING Boxing is the operation of converting a value-type into a value of a corresponding reference type. Boxing in C# is implicit. • Unboxing is the operation of converting a value of a reference type (previously boxed) into a value of a value type. • COMMON TYPE SYSTEM • C# has a unified type system. This unified type system is called Common Type System (CTS). • Generics use type parameters, which make it possible to design classes and methods that do not specify the type used until the class or method is instantiated ADVANTAGES OF C#
• It allows design time and run time attributes to
be included. • It allows integrated documentation using XML. No header files, IDL etc. are required. • It can be embedded into web pages. • Garbage collection ensures no memory leakage and stray pointers. • Due to exceptions, error handling is well- planned • C# source file may define any number of classes, structs, interfaces, and events. • C# build process is simple compared to C and C++ and more flexible than in Java. • There are no separate header files, and no requirement that methods and types be declared in a particular order. APPLICATIONS OF C# • The three main types of application that can be written in C# are: • 1. Win forms - Windows like Forms. • 2. Console - Command line Input and Output. 3. Web Sites : Web sites need IIS (Microsoft's web server) and ASP.NET.