TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ekta arora
NA
7
6.2k
c#, problem in executing a program of property
Aug 10 2012 2:12 PM
hi,
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)
}
}
}
The errors which i got are:
Reply
Answers (
1
)
Perfect number
I want currency format for textbox ?