Sample m = new Sample();
m.Length = 10;
Sample m = new Sample();
m.Length = m.Length + 20;
Sample m = new Sample();
int l;
l = m.Length;
Sample.Length = 20;
Console.WriteLine(Sample.Length);
Sample m = new Sample();
int l;
l = m.Length;
Sample.Length = 20;
Sample m = new Sample(); m.Length = 10;
Console.WriteLine(Sample.Length);
Sample m = new Sample(); int len; len = m.Length;
Sample m = new Sample(); m.Length = m.Length + 20;
class Student
{
int[] scores = new int[5] {3, 2, 4,1, 5};
public int this[ int index ]
{
set
{
if (index < 5)
scores[index] = value;
else
Console.WriteLine("Invalid Index");
}
}
}
class Student
{
int[] scores = new int[5] {3, 2, 4, 1, 5};
public int this[ int index ]
{
get
{
if (index < 5)
return scores[ index ];
else
{
Console.WriteLine("Invalid Index"); return 0;
}
}
set
{
if (index < 5)
scores[ index ] = value;
else
Console.WriteLine("Invalid Index");
}
}
}
class Student
{
int[] scores = new int[5] {3, 2, 4, 1, 5};
public int this[ int index ]
{
get
{
if (index < 5)
return scores[ index ];
else
{
Console.WriteLine("Invalid Index");
return 0;
}
}
}
}
class Student
{
int[] scores = new int[5] {3, 2, 4, 1, 5};
public int this[ int index ]
{
get
{
if (index < 5)
scores[ index ] = value;
else
{
Console.WriteLine("Invalid Index");
}
}
set
{
if (index < 5)
return scores[ index ];
else
{
Console.WriteLine("Invalid Index");
return 0;
}
}
}
}
class Student
{
int[] scores = new int[5] {3, 2, 4, 1, 5};
public int this[ int index ]
{
get
{
if (index < 5)
return scores[ index ];
else
{
Console.WriteLine("Invalid Index"); return 0;
}
}
set
{
if (index < 5)
scores[ index ] = value;
else
Console.WriteLine("Invalid Index");
}
}
}
Copyright ©CuriousTab. All rights reserved.