0% found this document useful (0 votes)
28 views1 page

C# Static Constructor Example

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

C# Static Constructor Example

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

using System;

using [Link];
using [Link];
using [Link];
using [Link];

namespace STATIC_CONSTRUCTOR
{
class person
{
public static string PersonName;
public static int PersonAge;

static person()
{
PersonName = "Ali";
PersonAge = 23;
[Link]("Static constructor invoked !!");
}

public person()
{
[Link]("default constructor invoked !!");
}

public static void GetDetails()


{
[Link]("Person name is: {0}", PersonName);
[Link]("Person Age is: {0}", PersonAge);
}
}
class Program
{
static void Main(string[] args)
{
person umar = new person();
person Ali = new person();
[Link]();
}
}
}

You might also like