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
venus najad
1.3k
414
27.9k
property and class variable inside a loop
Feb 21 2019 4:35 AM
hello... i have made a class student with a public string variable s1 and a RW property index...
in main method i read into index from the screen and in a loop is in main i check the value of s1, which is sets by index property... in my class student, i have a loop but the context of s1 is empty???!!! i aprreciate any help... regards
class Student{
public string s1;
public string index
{
get{return this.s1;}
set{ this.s1 = value; }
}
if(s1=="y"){...}
else{...}
static void Main(string[] args)
{
Student st = new Student();
Console.WriteLine("please choose y or n");
st.index = Console.ReadLine();
if (st.s1 == "y"||st.s1=="n"){....}
else {.....}
Reply
Answers (
6
)
How to sort a list with multiple parameters using CompareTo
Main form and login form