TypeLibFuncAttribute 類別


含有原來針對這個方法從 COM 型別程式庫匯入的 FUNCFLAGSContains the FUNCFLAGS that were originally imported for this method from the COM type library.

public ref class TypeLibFuncAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class TypeLibFuncAttribute : Attribute
type TypeLibFuncAttribute = class
    inherit Attribute
Public NotInheritable Class TypeLibFuncAttribute
Inherits Attribute


下列範例示範如何取得方法的 TypeLibFuncAttribute 值。The following example demonstrates how to get the TypeLibFuncAttribute value of a method.

using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;

ref class ClassC
   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


Tlbimp.exe (類型程式庫匯入工具)會將此屬性套用至方法。The Tlbimp.exe (Type Library Importer) applies this attribute to methods.

此屬性是在匯入類型程式庫時套用,而且永遠不會變更。This attribute is applied when a type library is imported and should never be changed. 只有當方法的 FUNCFLAGS 評估為非零時,才會套用它。It is only applied when the method's FUNCFLAGS evaluate to non zero. 屬性是設計用來讓需要知道如何設定原始 FUNCFLAGS 的工具使用。The attribute is designed to be used by tools that need to know how the original FUNCFLAGS were set. Common language runtime 不會使用這個屬性。The common language runtime does not use this attribute.



使用指定的 TypeLibFuncFlags 值,初始化 TypeLibFuncAttribute 類別的新執行個體。Initializes a new instance of the TypeLibFuncAttribute class with the specified TypeLibFuncFlags value.


使用指定的 TypeLibFuncFlags 值,初始化 TypeLibFuncAttribute 類別的新執行個體。Initializes a new instance of the TypeLibFuncAttribute class with the specified TypeLibFuncFlags value.



在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。When implemented in a derived class, gets a unique identifier for this Attribute.

(繼承來源 Attribute)

取得這個方法的 TypeLibFuncFlags 值。Gets the TypeLibFuncFlags value for this method.



傳回值,這個值指出此執行個體是否與指定的物件相等。Returns a value that indicates whether this instance is equal to a specified object.

(繼承來源 Attribute)

傳回這個執行個體的雜湊碼。Returns the hash code for this instance.

(繼承來源 Attribute)

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(繼承來源 Attribute)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(繼承來源 Attribute)

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)


_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。Maps a set of names to a corresponding set of dispatch identifiers.

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。Retrieves the type information for an object, which can be used to get the type information for an interface.

(繼承來源 Attribute)

擷取物件提供的類型資訊介面數目 (0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。Provides access to properties and methods exposed by an object.

(繼承來源 Attribute)