SynapseIndia Fundamentals of Dotnet Development Plateforms
SynapseIndia Fundamentals of Dotnet Development Plateforms
Development Plateforms
C# Features
No pointers
Automatic memory management
Completely object-oriented
Supports interface-based programming
Cd k:\week1\hello
Type corvars.bat <hit return>
4
Primitive Types
C# Type
bool
System.Boolean
byte
System.Byte
sbyte
System.Sbyte
char
System.Char
decimal
System.Decimal
double
System.Double
float
System.Single
9
int
System.Int32
uint
System.UInt32
long
System.Int64
ulong
System.UInt64
object
System.Object
short
System.Int16
ushort
System.UInt16
string
System.String
10
A word on types
Defining Integers
int i;
int i, j, k;
int i = 12;
j = i; j is now equal to 12
i = 15;
k = i + j; k is equal to 27
To write an Integer, convert it to a String using:
k.ToString();
13
14
15
string strTmp2;
strTmp2 = strTmp;
strTmp2 time will tell
16
Concatenating Strings
string strCity = Calais;
string strState = ME;
string strZip = 04270;
string strLoc;
strLoc = strCity + , + strState + + strZip;
strLoc Calais, ME 04270
17
19
String.Length Function
string strTmp;
strTmp = in the beginning;
The value of strTmp.Length is 16.
int i;
i = strTmp.Length;
The value of i is 16.
20
String.SubString() Function
String.Substring(startIndex , length );
substring.
21
Substring Examples
string strTmp;
strTmp = around the world;
strTmp.Substring(0,6); around
strTmp.Substring(11,5); world
strTmp.Substring(0,strTmp.Length);
around the world
22
24
if Statement
25
== is for equivalence
if (str1 == str2) { some code }
if (str.Length == 0) { some code }
if (str1 != end) { some code }
26
Sample if Statement
string strInput ;
strInput = Console.ReadLine();
if (strInput == )
{
Console.WriteLine(Input required.);
}
27
28
The Value of i is 9
The Value of i is 10
29
The Value of i is 2
The Value of i is 1
30
31
32
What About?
What If We Want To Enter More Data?
33
if (tmpStr.Length == 0)
{
Console.WriteLine(No String Entered);
goto ReturnHere;
}
Note: You could also check for tmpStr ==
35
36
37
Comments in C#
Use the menu bar, or Ctrl-K Ctrl-C for comment and CtrlK Ctrl-U for uncomment
38
39
40
Visual Studio.NET
Visual C#
Visual Basic.NET
Visual C++.NET
Can build
41
An MSDN subscription
A copy of Visual Studio.NET
42
Visual Studio.NET
43
44
46
Homework Part 1
Send Me An Email [email protected], include the
following:
1.
Full Name, Nick Name, Student ID #
2.
Home Phone / Work Phone
3.
Email Address (s) [email gives me one]
4.
Your background in computing/programming
5.
Any experience with .NET, other courses, ?
6.
Your objective or goals for this course
7.
Any material you have a special interest in covering?
8.
Any issues or questions that you have?
9.
Which additional dates you would attend classes on.
47
Homework Part 2
C#.Net Programming
Homework Assignment Week 1
Assignment Due: November 13, 2003 5:30 PM
48
50