MethodBuilder.SetCustomAttribute Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger ett anpassat attribut.
Överlagringar
| Name | Description |
|---|---|
| SetCustomAttribute(CustomAttributeBuilder) |
Anger ett anpassat attribut med hjälp av en anpassad attributbyggare. |
| SetCustomAttribute(ConstructorInfo, Byte[]) |
Anger ett anpassat attribut med en angiven anpassad attributblob. |
SetCustomAttribute(CustomAttributeBuilder)
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
Anger ett anpassat attribut med hjälp av en anpassad attributbyggare.
public:
void SetCustomAttribute(System::Reflection::Emit::CustomAttributeBuilder ^ customBuilder);
public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder);
member this.SetCustomAttribute : System.Reflection.Emit.CustomAttributeBuilder -> unit
Public Sub SetCustomAttribute (customBuilder As CustomAttributeBuilder)
Parametrar
- customBuilder
- CustomAttributeBuilder
En instans av en hjälpklass för att beskriva det anpassade attributet.
Undantag
customBuilder är null.
För den aktuella metoden är IsGenericMethodegenskapen true , men egenskapen IsGenericMethodDefinition är false.
Kommentarer
Metoden SetCustomAttribute kan interagera med SetImplementationFlags metoden när de två metoderna används i kombination. Mer information finns i avsnittet Kommentarer i SetImplementationFlags metoden.
Gäller för
SetCustomAttribute(ConstructorInfo, Byte[])
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
- Källa:
- MethodBuilder.cs
Anger ett anpassat attribut med en angiven anpassad attributblob.
public:
void SetCustomAttribute(System::Reflection::ConstructorInfo ^ con, cli::array <System::Byte> ^ binaryAttribute);
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);
[System.Runtime.InteropServices.ComVisible(true)]
public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute);
member this.SetCustomAttribute : System.Reflection.ConstructorInfo * byte[] -> unit
[<System.Runtime.InteropServices.ComVisible(true)>]
member this.SetCustomAttribute : System.Reflection.ConstructorInfo * byte[] -> unit
Public Sub SetCustomAttribute (con As ConstructorInfo, binaryAttribute As Byte())
Parametrar
- con
- ConstructorInfo
Konstruktorn för det anpassade attributet.
- binaryAttribute
- Byte[]
En byteblob som representerar attributen.
- Attribut
Undantag
con eller binaryAttribute är null.
För den aktuella metoden är IsGenericMethodegenskapen true , men egenskapen IsGenericMethodDefinition är false.
Kommentarer
Information om hur du formaterar binaryAttributefinns i metadataspecifikationen i partition II i CLI-specifikationen (Common Language Infrastructure).
Metoden SetCustomAttribute kan interagera med SetImplementationFlags metoden när de två metoderna används i kombination. Mer information finns i avsnittet Kommentarer i SetImplementationFlags metoden.