Write a program that declares a simple structure, declare at least two
variables with different data types and a static method in c#
using System;
namespace simple_structure
{
struct Person
{
public string name;
public int age;
public static void Print(string name, int age)
{
Console.WriteLine("Name: {0}, Age: {1}", name, age);
}
}
class Program
{
public static void Main(string[] args)
{
Person.Print("Smit", 23);
Console.Write("/nPress any key to continue . . . ");
Console.ReadKey(true);
}
}
}
Comments
Leave a comment