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 l'oggetto FUNCFLAGS originariamente importato 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;
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
TypeLibFuncAttribute(Int16) |
Inizializza una nuova istanza della classe |
TypeLibFuncAttribute(TypeLibFuncFlags) |
Inizializza una nuova istanza della classe |
Proprietà
TypeId |
Quando è implementata in una classe derivata, ottiene un identificatore univoco della classe Attribute. (Ereditato da Attribute) |
Value |
Ottiene il valore di TypeLibFuncFlags per questo metodo. |
Metodi
Equals(Object) |
Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. (Ereditato da Attribute) |
GetHashCode() |
Restituisce il codice hash per l'istanza. (Ereditato da Attribute) |
GetType() |
Ottiene l'oggetto Type dell'istanza corrente. (Ereditato da Object) |
IsDefaultAttribute() |
In caso di 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 equivale a un oggetto specificato. (Ereditato da Attribute) |
MemberwiseClone() |
Crea una copia superficiale dell'oggetto Object corrente. (Ereditato da Object) |
ToString() |
Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) |
Implementazioni dell'interfaccia esplicita
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch. (Ereditato da Attribute) |
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera le informazioni sul tipo relative a un oggetto, che possono essere usate per ottenere informazioni sul tipo relative a un'interfaccia. (Ereditato da Attribute) |
_Attribute.GetTypeInfoCount(UInt32) |
Recupera il numero delle 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 a proprietà e metodi esposti da un oggetto. (Ereditato da Attribute) |