CustomAttributeExtensions.GetCustomAttribute Metode

Definisi

Mengambil atribut kustom yang diterapkan ke elemen tertentu.

Overload

GetCustomAttribute(Assembly, Type)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke rakitan tertentu.

GetCustomAttribute(MemberInfo, Type)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu.

GetCustomAttribute(Module, Type)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke modul tertentu.

GetCustomAttribute(ParameterInfo, Type)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu.

GetCustomAttribute(MemberInfo, Type, Boolean)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu, dan secara opsional memeriksa leluhur anggota tersebut.

GetCustomAttribute(ParameterInfo, Type, Boolean)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu, dan secara opsional memeriksa leluhur parameter tersebut.

GetCustomAttribute<T>(ParameterInfo, Boolean)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu, dan secara opsional memeriksa leluhur parameter tersebut.

GetCustomAttribute<T>(MemberInfo, Boolean)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu, dan secara opsional memeriksa leluhur anggota tersebut.

GetCustomAttribute<T>(ParameterInfo)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu.

GetCustomAttribute<T>(Module)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke modul tertentu.

GetCustomAttribute<T>(MemberInfo)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu.

GetCustomAttribute<T>(Assembly)

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke rakitan tertentu.

GetCustomAttribute(Assembly, Type)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke rakitan tertentu.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::Assembly ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.Assembly element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.Assembly element, Type attributeType);
static member GetCustomAttribute : System.Reflection.Assembly * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As Assembly, attributeType As Type) As Attribute

Parameter

element
Assembly

Perakitan untuk diperiksa.

attributeType
Type

Jenis atribut yang akan dicari.

Mengembalikan

Atribut kustom yang cocok attributeTypedengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

element atau attributeType adalah null.

attributeType tidak berasal dari Attribute.

Ditemukan lebih dari salah satu atribut yang diminta.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute(MemberInfo, Type)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::MemberInfo ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType);
static member GetCustomAttribute : System.Reflection.MemberInfo * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As MemberInfo, attributeType As Type) As Attribute

Parameter

element
MemberInfo

Anggota yang akan diperiksa.

attributeType
Type

Jenis atribut yang akan dicari.

Mengembalikan

Atribut kustom yang cocok attributeTypedengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

element atau attributeType adalah null.

attributeType tidak berasal dari Attribute.

element bukan konstruktor, metode, properti, peristiwa, jenis, atau bidang.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute(Module, Type)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke modul tertentu.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::Module ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.Module element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.Module element, Type attributeType);
static member GetCustomAttribute : System.Reflection.Module * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As Module, attributeType As Type) As Attribute

Parameter

element
Module

Modul yang akan diperiksa.

attributeType
Type

Jenis atribut yang akan dicari.

Mengembalikan

Atribut kustom yang cocok attributeTypedengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

element atau attributeType adalah null.

attributeType tidak berasal dari Attribute.

Ditemukan lebih dari salah satu atribut yang diminta.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute(ParameterInfo, Type)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::ParameterInfo ^ element, Type ^ attributeType);
public static Attribute GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType);
public static Attribute? GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType);
static member GetCustomAttribute : System.Reflection.ParameterInfo * Type -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As ParameterInfo, attributeType As Type) As Attribute

Parameter

element
ParameterInfo

Parameter yang akan diperiksa.

attributeType
Type

Jenis atribut yang akan dicari.

Mengembalikan

Atribut kustom yang cocok attributeTypedengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

element atau attributeType adalah null.

attributeType tidak berasal dari Attribute.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute(MemberInfo, Type, Boolean)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu, dan secara opsional memeriksa leluhur anggota tersebut.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::MemberInfo ^ element, Type ^ attributeType, bool inherit);
public static Attribute GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
public static Attribute? GetCustomAttribute (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);
static member GetCustomAttribute : System.Reflection.MemberInfo * Type * bool -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As MemberInfo, attributeType As Type, inherit As Boolean) As Attribute

Parameter

element
MemberInfo

Anggota yang akan diperiksa.

attributeType
Type

Jenis atribut yang akan dicari.

inherit
Boolean

true untuk memeriksa leluhur element; jika tidak, false.

Mengembalikan

Atribut kustom yang cocok attributeTypedengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

element atau attributeType adalah null.

attributeType tidak berasal dari Attribute.

element bukan konstruktor, metode, properti, peristiwa, jenis, atau bidang.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute(ParameterInfo, Type, Boolean)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu, dan secara opsional memeriksa leluhur parameter tersebut.

public:
[System::Runtime::CompilerServices::Extension]
 static Attribute ^ GetCustomAttribute(System::Reflection::ParameterInfo ^ element, Type ^ attributeType, bool inherit);
public static Attribute GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
public static Attribute? GetCustomAttribute (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);
static member GetCustomAttribute : System.Reflection.ParameterInfo * Type * bool -> Attribute
<Extension()>
Public Function GetCustomAttribute (element As ParameterInfo, attributeType As Type, inherit As Boolean) As Attribute

Parameter

element
ParameterInfo

Parameter yang akan diperiksa.

attributeType
Type

Jenis atribut yang akan dicari.

inherit
Boolean

true untuk memeriksa leluhur element; jika tidak, false.

Mengembalikan

Atribut kustom yang attributeTypecocok , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

element atau attributeType adalah null.

attributeType tidak berasal dari Attribute.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute<T>(ParameterInfo, Boolean)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu, dan secara opsional memeriksa leluhur parameter tersebut.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::ParameterInfo ^ element, bool inherit);
public static T GetCustomAttribute<T> (this System.Reflection.ParameterInfo element, bool inherit) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.ParameterInfo element, bool inherit) where T : Attribute;
static member GetCustomAttribute : System.Reflection.ParameterInfo * bool -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As ParameterInfo, inherit As Boolean) As T

Jenis parameter

T

Jenis atribut yang akan dicari.

Parameter

element
ParameterInfo

Parameter yang akan diperiksa.

inherit
Boolean

true untuk memeriksa leluhur element; jika tidak, false.

Mengembalikan

T

Atribut kustom yang cocok Tdengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

elementadalah null.

element bukan konstruktor, metode, properti, peristiwa, jenis, atau bidang.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute<T>(MemberInfo, Boolean)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu, dan secara opsional memeriksa leluhur anggota tersebut.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::MemberInfo ^ element, bool inherit);
public static T GetCustomAttribute<T> (this System.Reflection.MemberInfo element, bool inherit) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.MemberInfo element, bool inherit) where T : Attribute;
static member GetCustomAttribute : System.Reflection.MemberInfo * bool -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As MemberInfo, inherit As Boolean) As T

Jenis parameter

T

Jenis atribut yang akan dicari.

Parameter

element
MemberInfo

Anggota yang akan diperiksa.

inherit
Boolean

true untuk memeriksa leluhur element; jika tidak, false.

Mengembalikan

T

Atribut kustom yang cocok Tdengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

elementadalah null.

element bukan konstruktor, metode, properti, peristiwa, jenis, atau bidang.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute<T>(ParameterInfo)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke parameter tertentu.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::ParameterInfo ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.ParameterInfo element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.ParameterInfo element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.ParameterInfo -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As ParameterInfo) As T

Jenis parameter

T

Jenis atribut yang akan dicari.

Parameter

element
ParameterInfo

Parameter yang akan diperiksa.

Mengembalikan

T

Atribut kustom yang cocok Tdengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

elementadalah null.

element bukan konstruktor, metode, properti, peristiwa, jenis, atau bidang.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute<T>(Module)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke modul tertentu.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::Module ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.Module element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.Module element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.Module -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As Module) As T

Jenis parameter

T

Jenis atribut yang akan dicari.

Parameter

element
Module

Modul yang akan diperiksa.

Mengembalikan

T

Atribut kustom yang cocok Tdengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

elementadalah null.

Ditemukan lebih dari salah satu atribut yang diminta.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute<T>(MemberInfo)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke anggota tertentu.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::MemberInfo ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.MemberInfo element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.MemberInfo element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.MemberInfo -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As MemberInfo) As T

Jenis parameter

T

Jenis atribut yang akan dicari.

Parameter

element
MemberInfo

Anggota yang akan diperiksa.

Mengembalikan

T

Atribut kustom yang cocok Tdengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

elementadalah null.

element bukan konstruktor, metode, properti, peristiwa, jenis, atau bidang.

Ditemukan lebih dari salah satu atribut yang diminta.

Jenis atribut kustom tidak dapat dimuat.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk

GetCustomAttribute<T>(Assembly)

Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs
Sumber:
CustomAttributeExtensions.cs

Mengambil atribut kustom dari jenis tertentu yang diterapkan ke rakitan tertentu.

public:
generic <typename T>
 where T : Attribute[System::Runtime::CompilerServices::Extension]
 static T GetCustomAttribute(System::Reflection::Assembly ^ element);
public static T GetCustomAttribute<T> (this System.Reflection.Assembly element) where T : Attribute;
public static T? GetCustomAttribute<T> (this System.Reflection.Assembly element) where T : Attribute;
static member GetCustomAttribute : System.Reflection.Assembly -> 'T (requires 'T :> Attribute)
<Extension()>
Public Function GetCustomAttribute(Of T As Attribute) (element As Assembly) As T

Jenis parameter

T

Jenis atribut yang akan dicari.

Parameter

element
Assembly

Perakitan untuk diperiksa.

Mengembalikan

T

Atribut kustom yang cocok Tdengan , atau null jika tidak ada atribut seperti itu yang ditemukan.

Pengecualian

elementadalah null.

Ditemukan lebih dari salah satu atribut yang diminta.

Keterangan

GetCustomAttributes Gunakan metode ekstensi jika Anda mengharapkan lebih dari satu nilai dikembalikan, atau AmbiguousMatchException akan dilemparkan.

Berlaku untuk