i m studyng property in c#. while writing a program i got some problem. plz try to rectify it. Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace prac1_const__prop_
{
class student
{
private string myname;
private int rollno;
//int rollno,phy, chem,maths,eng, hindi;
public string Name;
{
get
{return myname;} // ERROR WHICH I AM GETTING IS: Error 2 Invalid token '{' in class, struct, or interface member declaration C:\Users\ekta\Documents\Visual Studio 2008\Projects\prac1(const, prop)\prac1(const, prop)\Program.cs 17 9 prac1(const, prop)
set {myname= value;}
}
public int Rollno;
{
get{return rollno;}
set{rollno = value;}
}
class Program
{
static void Main(string[] args)
{
student st= new student();
st.myname = "ekta";
st.rollno = 55;
Console.WriteLine(st.myname);
Console.WriteLine(st.rollno)
}
}
}