using System;
using System.Collections.Generic;
using System.Text;
namespace structure_in_csharp
{
class Program
{
static void Main(string[] args)
{
Mystruct mstruct=new Mystruct ("sangram","Maharashtra",21);
mstruct.displayDetails();
Console.ReadKey();
}
struct Mystruct
{
int Age;
string Native;
string Name;
public Mystruct (string name,string native,int age)
{
Age=age;
Name =name;
Native=native;
}
public Mystruct(string name, int age)
{
Name=name;
Age=age;
Native = "Local";
}
public void displayDetails()
{
Console.WriteLine("Name:"+Name);
Console.WriteLine("Native:"+Native);
Console.WriteLine("Name:"+Age.ToString());
}
}
}
}
No comments:
Post a Comment