230 likes | 399 Views
Introduction to C#. Tuc Goodwin. Agenda. Upcoming Schedule Syntax Differences Exiting programs/methods/loops Member Scope Conditional Statements Indexes and Arrays Control Characters Loops Inheritance Overloading Summary. Upcoming Schedule . Intro to C# (November)
E N D
Introduction to C# Tuc Goodwin
Agenda • Upcoming Schedule • Syntax Differences • Exiting programs/methods/loops • Member Scope • Conditional Statements • Indexes and Arrays • Control Characters • Loops • Inheritance • Overloading • Summary
Upcoming Schedule • Intro to C# (November) • Debugging .NET 2.0 (December) • Serializations (January) • Object Thinking (February) • ADO.NET Revisited (March) Let’s look at some code!
Syntax Differences • Case Sensitivity • Line Termination • Comments • Namespace Declaration and Usage • Variable Declaration • Variable Initialization • Declaring Function Parameters
Exiting Programs/Methods/Loops • VB.Net – End • VB/C# - System.Environment.Exit(1) • VB.Net – Exit For / Exit Function • C# - break; • C# - continue;
C# vs. VB.Net • Static vs. Shared • static in C# • Shared in VB.Net • Classes vs. Modules • class • Module
Conditional Statement • VB.Net – If <condition> Then : Else : End If • C# - if( <condition>) { } else { }
Operators || Short Circuiting if (DoTask() || DoTask2()) { } If DoTask() or DoTask2() Then…
Ternary Operators • Visual Basic Immediate IFIIF(true/false), value for true, value for false • C# - (true/false clause)? Value for true: value for false;
Indexes and Arrays • Indexes • VB.Net use parenthesis (n) • C# use brackets [n] • Arrays • string[] phones = {“1”,”2”,”3”}; • phones = new string[3];
Loops • for(int count=1, count < 20; count++){} • for( string count=“”, count !=“done”;){} • string[] names = new string[5];foreach(string onename in names){…}
Type Comparison • VB.Net – Ctype() GetType() • C# - typeof()
Object Oriented - Inheritance • Class Checking : Account{…} • Class Checking Inherits Account…End Class
Object Oriented - Overloading • public void MakeDeposit(int Amount){} • public void MakeDeposit(ref int Amount, intAmountAvailable){} • Sub MakeDeposit (ByVal Amount as Integer)End Sub • Sub MakeDeposit (ByVal Amount as Integer, AmountAvailable as Integer)End Sub
Summary • We…
Other Resources • www.microsoft.com/net • msdn.microsoft.com/net • www.gotdotnet.com • support.microsoft.com/webcasts • www.dnug.net • www.devx.com/dotnet/ • www.thedotnetmag.com • www.winnetmag.com • www.microsoft.com/mspress
Next Time… We will continue to build from here… Debugging .NET 2.0