.


:




:

































 

 

 

 


Silverlight




, , : , .. . , . , . Windows Forms. .

. 4. TextBox

 

Silverlight C#. Silverlight (, TextBox), , TextBox. , :

resultTextBlock.Text = "0";

Set resultTextBlock, TextBlock .

C#. C# ( ) ( GetName SetName, ). , , Get Set. Silverlight.

, . , (public), . , . , , . :

public class Account

{

public int Age;

}

Account Age. :

Account s = new Account();

s.Age = 21;

, :

s.Age = 100210232;

, .

get set

, get set . . , Age (private), .

public class Account

{

private int age;

public int GetAge()

{

return this.age;

}

 

public void SetAge(int inAge)

{

if ((inAge > 0) && (inAge < 120))

{

this.age = inAge;

}

}

}

, . , :

Account s = new Account();

s.SetAge(21);

Console.WriteLine(": " + s.GetAge());

. Age :

public class Account

{

private int ageValue;

 

public int Age

{

set

{

if ((value > 0) && (value < 120))

ageValue = value;

}

get

{

return ageValue;

}

}

}

. . . , , :

Account s = new Account();

s.Age = 21;

Console.WriteLine(": " + s.Age);

Age , set. value , . Age get. , .

. (, 150), ( 120 ), . , , :

Account s = new Account();

int newAge = 150;

s.Age = newAge;

if (s.Age!= newAge)

Console.WriteLine(" ");

150, , . Set, false , .

. .

public int AgeInMonths

{

get

{

return this.ageValue * 12;

}

}

AgeInMonths. , set. , , Age. , . , , .

. , . Silverlight TextBlock, . . , Text , .

, TextBlock, , Silverlight , , . , Silverlight , .

, Text , TextBlock , , . . :

resultTextBlock.Text = "0";

C#, TextBlock .





:


: 2016-10-27; !; : 324 |


:

:

,
==> ...

1662 - | 1601 -


© 2015-2024 lektsii.org - -

: 0.054 .