Introduction of c# day3

351 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
351
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction of c# day3

  1. 1. All Right Reserved@ aumcp group of annamalai university(Arun Singh) Introduction of C# Presented By Arun Kumar Singh &Team Master of Computer Application Microsoft® Certified Professional MCP id- 7802107 arunsingh026@hotmail.com 1 www.microsoft.mcp.com 7/30/20131
  2. 2. WHAT IS C#? • C# (pronounced as ‘c sharp’) is a new computer programming language developed by Microsoft Corporation,USA. • C# is fully object oriented language like JAVA and is the first component-oriented language • Its development team is led by Anders Hejlsberg. • It is a simple ,efficient language derived from the popular c and c++. • Major parts of .NET framework is actually coded by C# • The most recent version is C# 5.0, which was released on August 15, 2012. • It is only component –oriented language available today. • C# is combines with the best features of visual basic , C++, and java. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 2
  3. 3. HISTORY ………………… • During the development of the .NET Framework, the class libraries were originally written using a managed code compiler system called Simple Managed C (SMC) • In January 1999,Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for "C-like Object Oriented Language". • Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons. • By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference, (MCP conference) the language had been renamed C#, and the class libraries and ASP.NET runtime had been ported to C#. • James Gosling, who created the Java programming language in 1994, and Bill Joy, a co- founder of Sun Microsystems, the originator of Java, called C# an "imitation" of Java; Gosling further claimed that "[C# is] sort of Java with reliability, productivity and security. Klaus Kraft and Angelika Langer (authors of a C++ streams book) stated in a blog post that "Java and C# are almost identical programming languages. Hardly anybody will claim that Java or C# are revolutionary programming languages that changed the way we write programs," and "C# borrowed a lot from Java - and vice versa. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 3
  4. 4. • Now that C# supports boxing and unboxing, we'll have a very similar feature in Java.Anders Hejlsberg has argued that C# is "not a Java clone" and is "much closer to C++" in its design. Versions: C# 1.0 January 2002 .NET Framework 1.0 Visual Studio .NET 2002 C# 1.2 April 2003 .NET Framework 1.1 Visual Studio .NET 2003 C# 2.0 November 2005 .NET Framework 2.0 Visual Studio 2005 .NET Framework 2.0 Visual Studio 2008 C# 3.0 November 2007 .NET Framework 3.0 Visual Studio 2010 .NET Framework 3.5 C# 4.0 April 2010 .NET Framework 4 Visual Studio 2010 C# 5.0 August 2012 .NET Framework 4.5 Visual Studio 2012 . 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh)4
  5. 5. EVOLUTION OF C# C C++ JAVA C# VB Component orientation concept ProductivityElegance 7/30/2013All Right Reserved@ aumcp group of annamalai university(Arun Singh)5
  6. 6. HOW DOES C# DIFFER FROM C++? • As stated earlier, c# was derived from c++ to make it the language of choice for c and c++ Programmers. • C# therefore shares major parts of syntax with c++.however , the c# designer introduce a few changes in the syntax of C++ and removed a few features primarily to reduce the common pitfalls that occurred in c++ program development. • They also added a number of additional features to make C# a type safe and web enabled language. C++ features: 1. Macros 2. Multiple Inheritance 3. Templates 4. Pointers 5. GlobalVariable 6. Typedef statement 7. Default arguments 8. Constant member function or parameter 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 6
  7. 7. Enhancement to C#....... 1. Automatic garbage collection 2. Version Support 3. Strict type safety 4. Properties to access data members 5. Delegates and events 6. Web services and much more…………………… 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 7
  8. 8. HOW DOES C# DIFFER FROM JAVA? • Like c# ,JAVA was also derived from C++ and therefore they have similar roots. Moreover, c# was developed by Microsoft as an alternative to java for web programming . • C# borrowed many goods features from JAVA, which has already become a popular internet language. • However, there exist a number of difference b/w c# and JAVA. 1. c# has more primitive data types than java. 2. Arrays are declared differtly in c# than java. 3. C# provides better versioning supports than java. 4. C# adds internal a new accessibility modifiers. 5. There is no labeled break statements in c#. The goto is used to achieve this And much more………… 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 8
  9. 9. MY FIRST C# HELLO PROGRAM using System; class Samplefirst { public static void Main(string[] args) { Console.WriteLine("hello c#, i feeling great being with u"); } } 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 9
  10. 10. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 10 USING: The using keyboard are allowed to us to use the various classes and interface etc. Which are define in respective Namespace. EX--- using System; //default Namespace System Console (namespace) (class) NOTE: using also contain a nested namespace. using namespace1.namespace2; a namespace2 which are define into a namespace1, so we define like that…………… EX---- using System.Collection;
  11. 11. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 11 The Namespace keyword: Namespace is nothing but a logical collection of related classes. The basic namespace of c# is System namespace. Which are contain all general classes and interfaces, Methods, which are generally used in a program. EX--- Namespace Class using System.Console.WriteLine(); keyword Methods Class: The c# program are allow to you to define a at least one class in your program, which Are build the main function.
  12. 12. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 12 Syntax class <class-name> { main function() { // statements parts is there……………. } }
  13. 13. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 13 The Main() Function: public static void Main(string args[]) • This is one of the standard signatures of the c# program. This methods act as entry point of your program • C# starts its execution from first line of your program and go for a end point of main method . • The keyword public is an access modifiers that tells that c# complier that main method can accessible by anyone • static- The main methods are design as a static, Why it is –it will called by a CLR without making any object . • void - The main method does not return any values. • string args[] – is a parameter list which are passed into a command line arguments. And taking a value in form of string. This is optional, but in java it is necessary. • NOTE: the c# always take a value in form of String.
  14. 14. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 14 COMMENTS: There are three kinds of comments, which are define into C#. • Single line comment e.g. // Similar in java • Multi line comment e.g. /* */ • Documents /// but in java-> /**………….*/ class Program // here we define class { static void Main(string[] args)// this is main function {/* there are stats in which in main function*/ Console.Write("hello c#");///lssjssdcks ///cksjcc ///cbkx ///xnx ///xdcjbs } }
  15. 15. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 15 SOME IMPORTANTS FACTS: • White spaces are ignored EX- class Program { static void Main(string[] args) { Console.Write("hello c#"); } } • Do not need to save your program. • This is not necessary that main method contain the arguments ‘(string args[])’. It is optional parameter. But in java is necessary to define a arguments. static void Main() { Console.Write("hello c#"); }
  16. 16. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh) 16 MAIN RETURN A VALUE: class sampletwo { static int Main(string[] args) { Console.Write("hello c#"); return 0; } NOTE: Another important aspect is the return type of Main().we have used void as the return in earlier programs .Main() can also return a value if it is declare as int type instead of void. When the return type in int, we must a return statement at the end of the method as shown above program. Return an integer type value to the system .the value return serve as the program termination Status code
  17. 17. 7/30/2013All Right Reserved@ aumcp group of annamalai university(Arun Singh)17 QUESTION REVIEW: 1. State at least five most important highlights of c# language. 2. How the c# better than java? 3. C# is modern language. Comment? 4. State five features of c++ that have not been incorporated into c#. 5. Explain the CLR? 6. State the software engineering phases, why it is important? 7. Why c# is very popular state one technical reason?
  18. 18. Next Conti……………….. 7/30/2013 All Right Reserved@ aumcp group of annamalai university(Arun Singh)18
  19. 19. Q &A Session More Information PostYour Questions on www.aumcp2013.jimdo.com aumcp2013@live.com All Right Reserved@ aumcp group of annamalai university(Arun Singh) 7/30/201319
  20. 20. Thanks to All All Right Reserved@ aumcp group of annamalai university(Arun Singh) 7/30/201320

×