TypeLibFuncAttribute Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Contiene le FUNCFLAGS importate originariamente per questo metodo dalla libreria dei tipi COM.
public ref class TypeLibFuncAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class TypeLibFuncAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeLibFuncAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
type TypeLibFuncAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TypeLibFuncAttribute = class
inherit Attribute
Public NotInheritable Class TypeLibFuncAttribute
Inherits Attribute
- Ereditarietà
- Attributi
Esempio
Nell'esempio seguente viene illustrato come ottenere il TypeLibFuncAttribute valore di un metodo .
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;
ref class ClassC
{
private:
static bool IsHiddenMethod( MethodInfo^ mi )
{
array<Object^>^MethodAttributes = mi->GetCustomAttributes( TypeLibFuncAttribute::typeid, true );
if ( MethodAttributes->Length > 0 )
{
TypeLibFuncAttribute^ tlf = dynamic_cast<TypeLibFuncAttribute^>(MethodAttributes[ 0 ]);
TypeLibFuncFlags flags = tlf->Value;
return (flags & TypeLibFuncFlags::FHidden) != (TypeLibFuncFlags)0;
}
return false;
}
};
using System.Reflection;
using System.Runtime.InteropServices;
namespace C
{
class ClassC
{
public static bool IsHiddenMethod(MethodInfo mi)
{
object[] MethodAttributes = mi.GetCustomAttributes(typeof(TypeLibFuncAttribute), true);
if (MethodAttributes.Length > 0)
{
TypeLibFuncAttribute tlf = (TypeLibFuncAttribute)MethodAttributes[0];
TypeLibFuncFlags flags = tlf.Value;
return (flags & TypeLibFuncFlags.FHidden) != 0;
}
return false;
}
}
}
Imports System.Reflection
Imports System.Runtime.InteropServices
Module C
Public Function IsHiddenMethod(ByVal mi As MethodInfo) As Boolean
Dim MethodAttributes As Object() = mi.GetCustomAttributes(GetType(TypeLibFuncAttribute), True)
If MethodAttributes.Length > 0 Then
Dim tlf As TypeLibFuncAttribute = MethodAttributes(0)
Dim flags As TypeLibFuncFlags = tlf.Value
Return (flags & TypeLibFuncFlags.FHidden) > 0
End If
Return False
End Function
End Module
Commenti
Il Tlbimp.exe (utilità di importazione libreria dei tipi) applica questo attributo ai metodi.
Questo attributo viene applicato quando viene importata una libreria dei tipi e non deve mai essere modificato. Viene applicato solo quando il metodo FUNCFLAGS restituisce un valore diverso da zero. L'attributo è progettato per essere usato dagli strumenti che devono sapere come sono stati impostati gli originali FUNCFLAGS . Common Language Runtime non usa questo attributo.
Costruttori
| Nome | Descrizione |
|---|---|
| TypeLibFuncAttribute(Int16) |
Inizializza una nuova istanza della |
| TypeLibFuncAttribute(TypeLibFuncFlags) |
Inizializza una nuova istanza della |
Proprietà
| Nome | Descrizione |
|---|---|
| TypeId |
Se implementato in una classe derivata, ottiene un identificatore univoco per questo Attribute. (Ereditato da Attribute) |
| Value |
Ottiene il TypeLibFuncFlags valore per questo metodo. |
Metodi
| Nome | Descrizione |
|---|---|
| Equals(Object) |
Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. (Ereditato da Attribute) |
| GetHashCode() |
Restituisce il codice hash per questa istanza. (Ereditato da Attribute) |
| GetType() |
Ottiene il Type dell'istanza corrente. (Ereditato da Object) |
| IsDefaultAttribute() |
Quando sottoposto a override in una classe derivata, indica se il valore di questa istanza è il valore predefinito per la classe derivata. (Ereditato da Attribute) |
| Match(Object) |
Quando sottoposto a override in una classe derivata, restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. (Ereditato da Attribute) |
| MemberwiseClone() |
Crea una copia superficiale del Objectcorrente. (Ereditato da Object) |
| ToString() |
Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) |
Implementazioni dell'interfaccia esplicita
| Nome | Descrizione |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Esegue il mapping di un set di nomi a un set corrispondente di identificatori dispatch. (Ereditato da Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera le informazioni sul tipo per un oggetto, che può essere utilizzato per ottenere le informazioni sul tipo per un'interfaccia. (Ereditato da Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
Recupera il numero di interfacce di informazioni sul tipo fornite da un oggetto (0 o 1). (Ereditato da Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fornisce l'accesso alle proprietà e ai metodi esposti da un oggetto . (Ereditato da Attribute) |