Декларирует или определяет свойство в типе или класс
е
Синтаксис
Параметры
typename 
fieldname 
имя свойства
new_value 
Значение, передаваемое в
	свойство, для присваивания
index 
значение индекса свойства
 Описание
Поля 
Property используются для получения и установки значения 
Type 
	или 
Class таким же образом, как и 
	другие поля данных, за исключением того, что вместо простого присвоения полю 
	или значению, извлеченному из поля, выполняется процедура.
typename - это имя типа, для которого метод 
Property 
	декларируется или определяется. Правила имени для 
typename 
	имеют те же правила, как у процедур при использовании в 
Namespace.
	
Property может иметь один необязательный параметр индекса.  С 
	индексом, свойства доступны как Property(Index) = Value.
	Скрытый параметр 
This имеет тот же тип
	
typename , передаваемый в процедуру свойства.  
This 
	используется для доступа к полям 
Type 
	или 
Class.
Пример
Type Vector2D
  As Single x, y
  Declare Operator Cast() As String
  Declare Property Length() As Single
  Declare Property Length( ByVal new_length As Single )
End Type
Operator Vector2D.cast () As String
  Return "(" + Str(x) + ", " + Str(y) + ")"
End Operator
Property Vector2D.Length() As Single
  Length = Sqr( x * x + y * y )
End Property
Property Vector2D.Length( ByVal new_length As Single )
  Dim m As Single = Length
  If m <> 0 Then
    '' new vector = old / length * new_length
    x *= new_length / m
    y *= new_length / m
  End If
End Property
Dim a As Vector2D = ( 3, 4 )
Print "a = "; a
Print "a.length = "; a.length
Print
a.length = 10
Print "a = "; a
Print "a.length = "; a.length
	Вывод:
a = (3, 4)
a.length =  5
a = (6, 8)
a.length =  10
Свойства с индексом:
  '' True/False
Namespace BOOL
  Const FALSE = 0
  Const TRUE = Not FALSE
End Namespace
Type BitNum
  Num As UInteger
  
    '' Свойства Получение/Установка 
каждое с индексом.
  Declare Property NumBit( ByVal Index As Integer ) As Integer
  Declare Property NumBit( ByVal Index As Integer, ByVal Value As Byte )
End Type
  '' Получить бит по его индексу.
Property BitNum.NumBit( ByVal Index As Integer ) As Integer
  Return Bit( This.Num, Index )
End Property
  '' Установить бит по его индексу.
Property BitNum.NumBit( ByVal Index As Integer, ByVal Value As Byte )
    '' Убедимся, что 
индекс находится в диапазоне Integer.
  If Index >= ( SizeOf(This.Num) * 8 ) Then
    Print "Out of uInteger Range!"
    Exit Property
  Else
    If Index < 0 Then Exit Property
  End If
  
  If Value = BOOL.FALSE Then
    This.Num = BitReset( This.Num, Index )
  End If
  
  If Value = BOOL.TRUE Then
    This.Num = BitSet( This.Num, Index )
  End If
  
End Property
Dim As BitNum Foo
Print "Testing property indexing with data types:"
Print "FOO Number's Value: " & Foo.Num
  '' Установим бит в числе, как
TRUE.
Foo.NumBit(31) = BOOL.TRUE
Print "Set the 31st bit of FOO"
  '' напечатаем, 
чтобы увидеть, если наш бит был изменен.
Print "FOO Number's Value: " & Foo.Num
Print "FOO 31st Bit Set? " & Foo.NumBit(31)
Sleep
Print ""
	Вывод:
Testing property indexing with data types:
FOO Number's Value: 0
Set the 31st bit of FOO
FOO Number's Value: 2147483648
FOO 31st Bit Set? -1
 См. также