C# ChapterOne
C# ChapterOne
Net
Type System
Int Class
Char Object
Decimal Array Storing in Heap
Float String Memory
Storing in Byte ………
Stack Memory ……. …….
…. Etc. …. Etc.
User Defined
Structure Data types
Enum
Difference Between Stack Memory and Heap Memory
C# C
#include <stdio.h>
#include <conio.h>
main()
{
Namespace
C
#include <stdio.h>
#include <conio.h>
main()
{
int Regno=100;
char gender=“M’;
printf (“%d ,%C “, Regno ,gender);
getch();
}
Read the values from user
Converting any Data Type to String Type Converting any Data Type to any data Type
int TotalMarks=452; string Price="150.00";
string Marks=TotalMarks.ToString(); int Amount=Convert.ToInt32(Price);
Int i = 10;
Boxing
Object obj;
Obj=i;
Value type implicitly
converted into
Unboxing
Object type is called
Boxing Object type
int k;
Explicitly converted
K=(int) obj into value type is
called Unboxing
Method
Method is nothing but group of statements.
Syntax
Example
With out Parameters With Parameters
Public int Add ( ) Public int Add (int x , int y )
{ {
int x , y , z; int z;
z= x +y; z= x + y;
Console.WriteLine(Z); Console.WriteLine(Z);
} }
Method Example
Static Method