Download presentation
Presentation is loading. Please wait.
Published byDelilah Goodwin Modified over 9 years ago
1
By Sam Nasr Nasr Information Systems May 14, 2013
2
Agenda Introduction What is.Net?.Net Framework Advantages of.Net/CLR Visual Studio C# Syntax
3
Introduction Sam Nasr, MCAD, MCTS, MCT Software Developer since 1995 Nasr Information Systems President Cleveland C#/VB.Net User Group President Cleveland WPF User Group President.Net Study Group INETA Mentor – Ohio Author - Visual Studio Magazine
4
What is.Net? New programming methodology Multiple Languages (VB.Net, C#, J#, etc.) IL JIT Compiler Primary Parts: 1..Net Framework 2. Common Language Runtime (CLR) - JIT Compiler RTM: v4.5, since 2000
5
.Net Framework A set of approximately 3500 classes. Classes are divided into namespaces grouping similar classes. For organization, each class belongs to only one namespace. Most classes are lumped into a name space called System System.Data: DB access System.XML: reading/writing XML System.Windows.Forms: Forms manipulation System.Net: network communication.
6
.Net Framework Supports Web Standards HTML XML XSLT SOAP WSDL (Web Services) ADO.Net: ActiveX Data Objects, EF ASP.Net: Active Server Pages Command Line Tools: ILDASM, ILASM, SN, etc.
7
Advantages of.Net Write once, run everywhere with.Net FW Multiple programming languages (20+) Coding Reduction Controls Template projects IIS/Cassini support Ease of Deployment Security Features
8
Visual Studio IDE for development Templates for: Console app, Web Service, Win Service, ASP.Net, Class Libraries Security tools VS Web Server (Cassini) Application Testing Team Suite for project management Express versions (free)
9
The C# Programming Language Microsoft proprietary language OO Language High-level Language Programs must be compiled before executed. Case sensitive Part of the.NET Framework, used for: ASP.Net Console Apps WF WCF WPF MVC
10
Elements of a C# Program Data TypesTypes of data in a program. Common data types are int (integers), char (single character value), float (floating point values). VariablesProvides temporary storage during program execution. int number = 10; ConstantsData fields whose value cannot be modified. const int i = 10; ArraysA collection of items in which each item can be accessed by a unique index. int[] numbers = { 1, 2, 3, 4, 5 }; OperatorsSymbols that specify which operation to perform on operands before returning a result. MethodsMethods are code blocks containing a series of statements. Methods can receive input via arguments and can return a value to the caller.
11
Structure of a C# Program
12
The if-else Statement The if-else statement allows your program to perform one action if the Boolean expression evaluates to true and a different action if the Boolean expression evaluates to false.
13
Demo
14
Exception Handling An exception is an unexpected error condition that occurs during program execution. When exception occurs, the runtime creates an exception object and “throws” it. Unless you “catch” the exception, the program execution will terminate. Exceptions are an object of the System.Exception class or one of its derived classes. Example: DivideByZeroException exception object is thrown when the program attempts to divide by zero. Example: FileNotFoundException exception object is throws when the program cannot find a given file.
15
Unhandled Exceptions What happens when the file c:\data.txt is not found in this code?
16
Handling Exceptions Place the code that throws the exceptions inside a try block. Place the code that handles an exception inside a catch block. You can have more than one catch blocks for each try block. Each catch block handles a specific exception type. A try block must have at least a catch block or a finally block associated with it.
17
Exception Handling Sample
18
The finally Block The finally block is used in association with the try block. The finally block is always executed regardless of whether an exception is thrown. The finally block is often used to write clean-up code.
19
try-catch-finally Example
20
Resources C# Jumpstart Training: https://www.microsoftvirtualacademy.com/training- courses/developer-training-with-programming-in-c https://www.microsoftvirtualacademy.com/training- courses/developer-training-with-programming-in-c Community Megaphone: http://www.communitymegaphone.com/http://www.communitymegaphone.com/ C#/VB.Net Special Interest Group: http://www.ClevelandDotNet.info/http://www.ClevelandDotNet.info/ Cleveland WPF User Group: http://www.clevelandwpf.info/http://www.clevelandwpf.info/.Net Study Group: http://www.meetup.com/net-study-Group/http://www.meetup.com/net-study-Group/
21
Contact Info sam@nasr.info http://ClevelandDotNet.blogspot.com @SamNasr http://www.linkedin.com/in/samsnasr Thank you for attending!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.