The namespace ConsoleApp2
{
Public class Student
{
Private int _AGE;
Public int the AGE
{the get=& gt; _AGE; The set=& gt; _AGE=value; }
The namespace ConsoleApp2
{
Class Program
{
The static void Main (string [] args)
{
Student student=new Student();
Student. AGE=18;//set the attribute values, so that the object of the Age value of 18
Console. WriteLine ($" xiao Ming's AGE is {student. AGE} ");//get the student. The Age attribute value
The Console. ReadKey ();
}
}
}
Now want to add conditions assignment with a point value between 0 and 100 - year - old age is direct assignment, if not in the scope of direct assignment is 20.
CodePudding user response:
The set=& gt; {If (value> 0 & amp; & Value<50)
_AGE=value;
The else
_AGE=20.
}
CodePudding user response:
According to your format can't see the appended drawings can you help me to look again at {there is an error red