<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=ASP.Net%2FLanguage_Basics%2FProperty</id>
		<title>ASP.Net/Language Basics/Property - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=ASP.Net%2FLanguage_Basics%2FProperty"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=ASP.Net/Language_Basics/Property&amp;action=history"/>
		<updated>2026-04-30T02:56:24Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=ASP.Net/Language_Basics/Property&amp;diff=2229&amp;oldid=prev</id>
		<title> в 15:30, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=ASP.Net/Language_Basics/Property&amp;diff=2229&amp;oldid=prev"/>
				<updated>2010-05-26T15:30:47Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:30, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=ASP.Net/Language_Basics/Property&amp;diff=2230&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=ASP.Net/Language_Basics/Property&amp;diff=2230&amp;oldid=prev"/>
				<updated>2010-05-26T11:53:26Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Define and use properties (C#)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;%@ page Language=&amp;quot;c#&amp;quot; runat=&amp;quot;server&amp;quot; %&amp;gt;&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
  public class Calculator&lt;br /&gt;
  {&lt;br /&gt;
    private double currentValue;&lt;br /&gt;
    public double CurrentValue&lt;br /&gt;
    {&lt;br /&gt;
      get &lt;br /&gt;
      {&lt;br /&gt;
        return currentValue;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    public void Add(double addValue)&lt;br /&gt;
    {&lt;br /&gt;
      currentValue += addValue;&lt;br /&gt;
    }&lt;br /&gt;
    public void Subtract(double subValue)&lt;br /&gt;
    {&lt;br /&gt;
      currentValue -= subValue;&lt;br /&gt;
    }&lt;br /&gt;
    public void Multiply(double multValue)&lt;br /&gt;
    {&lt;br /&gt;
      currentValue *= multValue;&lt;br /&gt;
    }&lt;br /&gt;
    public void Divide(double divValue)&lt;br /&gt;
    {&lt;br /&gt;
      currentValue /= divValue;&lt;br /&gt;
    }&lt;br /&gt;
    public void Clear()&lt;br /&gt;
    {&lt;br /&gt;
      currentValue = 0;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  void Page_Load() &lt;br /&gt;
  {&lt;br /&gt;
    Calculator MyCalc = new Calculator();&lt;br /&gt;
    Response.Write(&amp;quot;&amp;lt;b&amp;gt;Created a new Calculator object.&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
    Response.Write(&amp;quot;Current Value = &amp;quot; + MyCalc.CurrentValue);&lt;br /&gt;
    MyCalc.Add(23);&lt;br /&gt;
    Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Added 23 - MyCalc.Add(23)&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
    Response.Write(&amp;quot;Current Value = &amp;quot; + MyCalc.CurrentValue);&lt;br /&gt;
    MyCalc.Subtract(7);&lt;br /&gt;
    Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Subtracted 7 - MyCalc.Subtract(7)&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
    Response.Write(&amp;quot;Current Value = &amp;quot; + MyCalc.CurrentValue);&lt;br /&gt;
    MyCalc.Multiply(3);&lt;br /&gt;
    Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Multiplied by 3 - MyCalc.Multiply(3)&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
    Response.Write(&amp;quot;Current Value = &amp;quot; + MyCalc.CurrentValue);&lt;br /&gt;
    MyCalc.Divide(4);&lt;br /&gt;
    Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Divided by 4 - MyCalc.Divide(4)&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
    Response.Write(&amp;quot;Current Value = &amp;quot; + MyCalc.CurrentValue);&lt;br /&gt;
    MyCalc.Clear();&lt;br /&gt;
    Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Cleared - MyCalc.Clear()&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;);&lt;br /&gt;
    Response.Write(&amp;quot;Current Value = &amp;quot; + MyCalc.CurrentValue);&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Properties for read and write (C#)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;%@ page Language=&amp;quot;c#&amp;quot; runat=&amp;quot;server&amp;quot; %&amp;gt;&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
public class Car&lt;br /&gt;
{&lt;br /&gt;
  private string color;&lt;br /&gt;
  private int gear;&lt;br /&gt;
  public string Color&lt;br /&gt;
  {&lt;br /&gt;
    get &lt;br /&gt;
    {&lt;br /&gt;
      return color;&lt;br /&gt;
    }&lt;br /&gt;
    set &lt;br /&gt;
    {&lt;br /&gt;
      color = value;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public int Gear&lt;br /&gt;
  {&lt;br /&gt;
    get &lt;br /&gt;
    {&lt;br /&gt;
      return gear;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public void ChangeGear(int Direction)&lt;br /&gt;
  {&lt;br /&gt;
    if (Direction &amp;lt; 0)&lt;br /&gt;
      gear--;&lt;br /&gt;
    if (Direction &amp;gt; 0)&lt;br /&gt;
      gear++;&lt;br /&gt;
    if ( gear &amp;gt; 5) &lt;br /&gt;
      gear = 5;&lt;br /&gt;
    if ( gear &amp;lt; -1) &lt;br /&gt;
      gear = -1;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
void Page_Load()&lt;br /&gt;
{&lt;br /&gt;
  Car MyCar = new Car();&lt;br /&gt;
  Response.Write(&amp;quot;&amp;lt;b&amp;gt;New object &amp;quot;MyCar&amp;quot; created.&amp;lt;/b&amp;gt;&amp;quot;);&lt;br /&gt;
  Response.Write(&amp;quot;&amp;lt;br/&amp;gt;Color: &amp;quot; + MyCar.Color);&lt;br /&gt;
  Response.Write(&amp;quot;&amp;lt;br/&amp;gt;Gear: &amp;quot; + MyCar.Gear);&lt;br /&gt;
  MyCar.Color = &amp;quot;Black&amp;quot;;&lt;br /&gt;
  MyCar.ChangeGear(+1);&lt;br /&gt;
  Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Properties updated.&amp;lt;/b&amp;gt;&amp;quot;);&lt;br /&gt;
  Response.Write(&amp;quot;&amp;lt;br/&amp;gt;New color: &amp;quot; + MyCar.Color);&lt;br /&gt;
  Response.Write(&amp;quot;&amp;lt;br/&amp;gt;New gear: &amp;quot; + MyCar.Gear);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Throw Exception in Property setter (VB.net)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;%@ Page Language=&amp;quot;VB&amp;quot; %&amp;gt;&lt;br /&gt;
&amp;lt;script runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
Public Class Math&lt;br /&gt;
    Private intValue As Integer&lt;br /&gt;
    Public Property InValue() As Integer&lt;br /&gt;
        Get&lt;br /&gt;
            Return intValue&lt;br /&gt;
        End Get&lt;br /&gt;
        Set(ByVal value As Integer)&lt;br /&gt;
            If intValue &amp;gt; 0 Then&lt;br /&gt;
                intValue = value&lt;br /&gt;
            Else&lt;br /&gt;
                Throw New Exception(&amp;quot;InValue can not be less than 1&amp;quot;)&lt;br /&gt;
            End If&lt;br /&gt;
        End Set &lt;br /&gt;
    End Property&lt;br /&gt;
    Public Function MultiplyBySelf(ByVal InValue As Integer) As Integer&lt;br /&gt;
        Return Multiply(InValue, InValue)&lt;br /&gt;
    End Function&lt;br /&gt;
    Private Function Multiply(ByVal FirstValue As Integer, ByVal SecondValue As Integer)&lt;br /&gt;
        Return FirstValue * SecondValue&lt;br /&gt;
    End Function&lt;br /&gt;
End Class&lt;br /&gt;
    Sub Page_Load()&lt;br /&gt;
        Dim clsMath As Math&lt;br /&gt;
        clsMath = New Math&lt;br /&gt;
        clsMath.InValue = 10&lt;br /&gt;
        lblMessage.Text = clsMath.MultiplyBySelf(10)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;head id=&amp;quot;Head1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;Show Shared Hello World&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;asp:Label&lt;br /&gt;
        id=&amp;quot;lblMessage&amp;quot;&lt;br /&gt;
        Runat=&amp;quot;server&amp;quot; /&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>