class Program
{
//This function will work fine with an assigned variable
//However it will not work with an unassigned variable
static void testfun1(ref int maya)
{
Console.WriteLine(maya);
maya = 3;
}
//This function will work fine with a defined variable but assignment is not mandatory
static void testfun2(out int maya)
{
maya = 4;
}
static void Main(string[] args)
{
int dedo = 12;
int dedo2;
// testfun1(ref dedo2); will not compile since dedo2 is not assigned
Console.WriteLine("Test for Erdem");
Console.WriteLine(dedo);
testfun2(out dedo2); // this will be fine
Console.WriteLine(dedo2);
Console.ReadKey();
}
}
Monday, July 08, 2013
Subscribe to:
Post Comments (Atom)
Categories
Blog Archive
-
▼
2013
(24)
-
▼
July
(14)
- Polymorphism nedir
- Static Fields in a class
- What is a constructor
- Defining and using a class and Constructor
- Memory Usage by Classes, Methods and Functions
- Encapsulation 3
- What is Encapsulation 2
- What is Encapsulation
- Reading and Writing to a File
- Exception Example
- Beginning Visual C# 2010
- Animated Elipse in C#
- Ref and Out in Visual C#
- How to download an image from a website using c#
-
▼
July
(14)
Popular Posts
Powered by Blogger.
0 comments:
Post a Comment