// Получить поле Проверено.
Console.WriteLine("Проверено: {0}.", MyAttribute[i].Reviewed);
}
}
MC++
public:
static void GetAttribute(Type* t) {
// Получить атрибут.
DeveloperAttribute* MyAttribute __gc[] =
__try_cast<DeveloperAttribute* __gc[]>(Attribute::GetCustomAttributes(t, __typeof(DeveloperAttribute)));
if (MyAttribute == 0) Console::WriteLine(S"Атрибут не найден.");
else for (int i = 0; i < MyAttribute.Length; i++) {
// Получить поле Имя.
Console::WriteLine(S"Имя: {0}." , MyAttribute[i]->Name);
// Получить поле Уровень.
Console::WriteLine(S"Уровень: {0}." , MyAttribute[i]->Level);
// Получить поле Проверено.
Console::WriteLine(S"Проверено: {0}." , MyAttribute[i]->Reviewed);
}
}
Visual Basic.NET
Public Shared Sub GetAttribute(t As Type)
' Получить атрибут.
Dim MyAttribute As DeveloperAttribute() = _
CType(Attribute.GetCustomAttributes(t, GetType(DeveloperAttribute)), DeveloperAttribute())
If MyAttribute Is Nothing Then
Console.WriteLine("Атрибут не найден.")
Else
Dim i As Integer
For i = 0 To MyAttribute.Length – 1 ' Получить поле Имя.