R4R C# C# Examples Define Structure in C#

C# Examples             

Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Example of Structure in C#

         



/*
Structure:-
	1)It is a kind of value type
	---------------
	Data Type :-
	1)Value Type(normal data type(int/byte/short/long/float/char)/structure/enum
	2)Reference Type (Array/Class/ Object / Interface/Delegates)
	--------------
	2)It is more or less like a class
	3)It can contain constructor  but that must be  parameterized
	4)Structure is by default sealed(we cant inherit)
	5)we can create object with or without new
*/
struct a
{
	public void display()
	{
		System.Console.WriteLine("R4R");
	}
}
class b
{
	public static void Main()
	{
		a t=new a();
		t.display();
	}
}

 Download Source Code

Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40