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

C# Static Class Example

This C# code defines a static Man class with string Name and int Age properties. It also has a GetInformation method that returns a formatted string of the man's name and age. The main method sets Man's name to "Tester" and age to 22, calls GetInformation to output "Tester is 22 years old", and waits for user input.

Uploaded by

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

C# Static Class Example

This C# code defines a static Man class with string Name and int Age properties. It also has a GetInformation method that returns a formatted string of the man's name and age. The main method sets Man's name to "Tester" and age to 22, calls GetInformation to output "Tester is 22 years old", and waits for user input.

Uploaded by

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

using System;

using [Link];
using [Link];

namespace ConsoleApp13
{
static class Man
{
public static string Name { get; set; }
public static int Age { get; set; }

public static string GetInformation()


{
return [Link]("{0} is {1} years old", Name, Age);
}
}
}

using System;

namespace ConsoleApp13
{
class Program
{

static void Main(string[] args)


{
[Link] = "Tester";
[Link] = 22;
[Link]([Link]());
[Link]();
}

}
}

You might also like