Your SlideShare is downloading. ×
C# Fundamental
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

C# Fundamental

385
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
385
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Parts of an elephant Touching an elephant one blind might be wondering that elephant is a wall …as he has touched the body part of the the elephant One might has touched the tail… N he might br wondering that elephant is a rope…. N another might has touched the legs N he might be wondering that elephant is what you call tree…. N one who touched the ears he might think elephant is a fan like thing 
  • Software/ computer programs for different purposes We have Microsoft office package
  • Transcript

    • 1. ProgrammingFundamentals ICourse Code 109Sri Lanka Institute of Information Technology Jagath Wickramarathne Jagath.w@sliit.lk
    • 2. Lecture 2 - Learning C# Basics• Introducing the .NET Platform.• Steps involved in C# program development.• Computer Programming Languages.• What Is .NET?• Writing a Simple C# Program.• Commenting Code.• Identifiers and Keywords.• Convention and Style.• Getting Started with C# and Visual Studio 2008.
    • 3. How user interacts with Computer • Click to edit Master text styles App lica – Second level Soft tion ware – Third level • Fourth level – Fifth levelhttp://www.nickhalstead.com/wp-content/computer-user.jpg
    • 4. Software . . .? http://patentu.blogspot.com/2007/03/what-is-software.html
    • 5. Why Computer Programs?A computer program is a sequence of instructions that enable a computer to accomplish a particular task.
    • 6. Computer Programming LanguagesA programming language is a machine-readable artificial languagedesigned to express computations that can be performed by amachine, particularly a computer.Programming languages can be used to createprograms that specify the behavior of a machine,to express algorithms precisely, or as a mode of human communication. http://en.wikipedia.org/wiki/Programming_language• http://www.levenez.com/lang/• http://www.engin.umd.umich.edu/CIS/course.des/cis400/
    • 7. How you can select a ComputerProgramming Language How you can select a Computer Programming Language
    • 8. What Is .NET?• Microsoft .NET, is a platform for developing software.• You are building applications on: Microsoft .NET (pronounced “Dot Net”).• You learn about the parts of .NET, – including the Common Language Runtime (CLR), – the .NET Framework Class Library, and how .NET supports multiple languages.
    • 9. NET supports multiple programming languages.• Literally dozens of languages target the .NET CLR as a platform.PF IPF II ITA
    • 10. What Can a C# Program Do?• Typical programming tasks includes putting data into a database or pulling it out, displaying high speed graphics in a game or video, controlling electronic devices attached to the PC or even playing music and/or sound effects.• You can even write software to generate music or help you compose. http://cplus.about.com/od/introductiontoprogramming/a/cshbeginners.htm
    • 11. Is C# The Best Programming Language?• Some computer languages were written for a specific purpose. – Java was originally devised to control toasters. – C for Operating Systems Programming. – Pascal to teach good programming techniques.• But C# is a general purpose language with features to make programs more robust. – Fully OOP – Automatic garbage collection (don’t have to delete objects) – No pointers – Only booleans allowed in if statements – Everything inherits from System.Object – Array bounds checking at runtime
    • 12. Which Computers Can Run C#?Any that can run the • .NET framework. • On Linux under MonoProject & IDE.
    • 13. How Do I Get Started With C#?• .NET framework.• First you need a Editor.• Then a C# compiler. – There are a number of commercial and free ones available. – The list below has instructions for downloading and installing two free compilers. – Both are completely free and include an IDE to make life easier for you to edit, compile and debug your applications. – Download and Install Borlands Turbo C# Explorer. – Download and Install Microsofts Visual C# 2005 Express Edition.
    • 14. Could I Get A Programming Job?• There are an increasing number of C# jobs out there and it has the backing of Microsoft so is likely to be around for a considerable length of time.• The top three most popular programming languages according to the quarterly Tiobe.com survey, are Java, C and C#.• Eg. Search Google – “most popular programming languages” – “C# + Salary”
    • 15. How to write Computer Programs• There are four general phases – Specify the problem, – Analyze and break down into a series of steps towards solution, (i.e., design an algorithm), – Write the code, – Compile and run (i.e., test the program)
    • 16. Steps involved in C# program development
    • 17. C# Compilation Process http://www.mastercsharp.com/article.aspx?ArticleID=90&&TopicID=4
    • 18. Where Do I Go Now?• First you have to learn to program in C#. – Text Book – MSDN – Internet – E-books – Join The Forums – http://dotnetforum.lk/ – Etc.
    • 19. Writing a Simple C# ProgramEditor / IDE Project TypeNotepad Console ApplicationVisual Studio 2008 Windows Forms Application
    • 20. C# - Console Applications using Visual Studio 2008 Command Prompt• Step I – Open a notepad.• Step II – Write the following code and save as “FirstProgram.cs”.• Step III – Open Visual Studio 2008 Command Prompt. – Change the current directory to the place where you save “FirstProgram.cs”.• Step IV – Type “csc FirstProgram1.cs” compile command.• Step IV – Run FirstProgram1.exe
    • 21. Demo One• How to create a C# console application using Visual Studio 2008 Command Prompt.
    • 22. C# - Windows Applications using Visual Studio 2008• Step I • Run Microsoft Visual studio 2008.• Step II • Create new project “Windows Forms Application”• Step III • Design Interface / Form• Step IV • Compile• Step V • Run
    • 23. Demo Two• How to create a C# Windows Forms application using Visual Studio 2008. – Solution – Project • .EXE
    • 24. Demo Three Navigating through Design and Code modes. Different windows / Features in VS2008 IDE.
    • 25. C# - Convention and Style• It is common practice in C# to use whitespace and indentation to facilitate easier reading of code.• The names should describe what the program does.• A program may have any amount of white-space between language elements.• Identifiers are structured, using either Pascal casing or camel casing.• In Pascal casing the first letter of each word in a name is capitalized – HelloWorld, DotProduct, and AmortizationSchedule. – This is normally used in all instances except for parameters (passed to methods), private fields (class member variables), and local variables (method variables).• With camel casing, the first letter of the first word is lowercase, and subsequent words are capitalized. – bookTitle, employeeName, and totalCompensation. – Parameters, private fields, and local variables use camel casing.
    • 26. Commenting Code• Part of writing good code is ensuring it is properly documented.• These commenting techniques prove useful any time you want to comment out a block of incomplete code to get a good compile or any other time you want to leave a block of code in place temporarily.• The compiler ignores comments when reading the source code.• There are three types of commenting syntax in C#: – single line – multiline – XML• The multiline and single-line comments are great for helping yourself or other programmers understand your code.• XML documentation commenting feature that is good for both reading code and providing external documentation .
    • 27. • Single-Line Comments – They begin with the double forward slash marker,//The single-line comment• Multiline Comments – Multiline comment delimiters are the begin comment /* and end comment */ markers. – Anything between these two markers is considered a comment./** File Name: Program.cs* Author: Nishani Ranpatabendi*/• XML Documentation Comments – XML documentation comment supports tools that extract comments into an external XML document. – This XML can be consumed by tools or run through XSLT style sheets to produce readable documentation. – XML documentation comments start with a triple slash, ///, on each line. – /// <summary> – /// first method executed in application – /// </summary> – /// <param name=”args”>command-line options</param> – static void Main(string[] args) – { – // other code – }
    • 28. Identifiers and Keywords• Identifiers and keywords are important because you need to know how to name your variables, custom types, methods, and so on.• Identifiers are names of the types and variables in your program.• Keywords are reserved words in the C# language.• The difference between identifiers and keywords is that keywords are reserved for C# language syntax and can’t be used for naming your variables, types, and so on.
    • 29. Reserved words in the C# language You can prefix keywords with the @ character and use it as an identifier.
    • 30. Case Sensitive Languages• C# programming language is case sensitive. – If the language considers two identifiers to be different if they consist of the same characters in the same order except for variations in upper and lower case.• Name name NAME would be three different identifiers in a language which is case sensitive.• C# is case sensitive.
    • 31. Summery• Introducing the .NET Platform.• Steps involved in C# program development.• Computer Programming Languages.• What Is .NET?• Writing a Simple C# Program.• Commenting Code.• Identifiers and Keywords.• Convention and Style.• Getting Started with C# and Visual Studio 2008.
    • 32. Reference http://msdn.microsoft.com/en-us/vcsharp/bb798022.aspxo edit Master subtitle style