다음을 통해 공유


VarEnum 열거형

배열이 관리 코드에서 비관리 코드로 UnmanagedType.SafeArray로 마샬링될 때 배열 요소가 마샬링될 방법을 나타냅니다.

네임스페이스: System.Runtime.InteropServices
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration VarEnum
‘사용 방법
Dim instance As VarEnum
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum VarEnum
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum class VarEnum
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum VarEnum
SerializableAttribute 
ComVisibleAttribute(true) 
public enum VarEnum

멤버

  멤버 이름 설명
Supported by the .NET Compact Framework VT_ARRAY SAFEARRAY 포인터를 나타냅니다. 
Supported by the .NET Compact Framework VT_BLOB 길이 접두사가 있는 바이트를 나타냅니다. 
Supported by the .NET Compact Framework VT_BLOB_OBJECT blob이 개체를 포함하고 있다는 것을 나타냅니다. 
Supported by the .NET Compact Framework VT_BOOL 부울 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_BSTR BSTR 문자열을 나타냅니다. 
Supported by the .NET Compact Framework VT_BYREF 값이 참조임을 나타냅니다. 
Supported by the .NET Compact Framework VT_CARRAY C 스타일 배열을 나타냅니다. 
Supported by the .NET Compact Framework VT_CF 클립보드 형식을 나타냅니다. 
Supported by the .NET Compact Framework VT_CLSID 클래스 ID를 나타냅니다. 
Supported by the .NET Compact Framework VT_CY 통화 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_DATE DATE 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_DECIMAL decimal 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_DISPATCH IDispatch 포인터를 나타냅니다. 
Supported by the .NET Compact Framework VT_EMPTY 값이 지정되지 않았음을 나타냅니다. 
Supported by the .NET Compact Framework VT_ERROR SCODE를 나타냅니다. 
Supported by the .NET Compact Framework VT_FILETIME FILETIME 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_HRESULT HRESULT를 나타냅니다. 
Supported by the .NET Compact Framework VT_I1 char 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_I2 short 정수를 나타냅니다. 
Supported by the .NET Compact Framework VT_I4 long 정수를 나타냅니다. 
Supported by the .NET Compact Framework VT_I8 64비트 정수를 나타냅니다. 
Supported by the .NET Compact Framework VT_INT 정수 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_LPSTR null로 끝나는 문자열을 나타냅니다. 
Supported by the .NET Compact Framework VT_LPWSTR Null 참조(Visual Basic의 경우 Nothing)로 끝나는 와이드 문자열을 나타냅니다. 
Supported by the .NET Compact Framework VT_NULL SQL의 null 값과 비슷한 null 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_PTR 포인터 형식을 나타냅니다. 
Supported by the .NET Compact Framework VT_R4 float 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_R8 double 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_RECORD 사용자 정의된 형식을 나타냅니다. 
Supported by the .NET Compact Framework VT_SAFEARRAY SAFEARRAY를 나타냅니다. VARIANT에서는 유효하지 않습니다. 
Supported by the .NET Compact Framework VT_STORAGE 그 뒤에 저장소 이름이 나온다는 것을 나타냅니다. 
Supported by the .NET Compact Framework VT_STORED_OBJECT 저장소가 개체를 포함하고 있음을 나타냅니다. 
Supported by the .NET Compact Framework VT_STREAM 그 뒤에 스트림 이름이 나온다는 것을 나타냅니다. 
Supported by the .NET Compact Framework VT_STREAMED_OBJECT 스트림이 개체를 포함하고 있음을 나타냅니다. 
Supported by the .NET Compact Framework VT_UI1 byte를 나타냅니다. 
Supported by the .NET Compact Framework VT_UI2 unsignedshort을 나타냅니다. 
Supported by the .NET Compact Framework VT_UI4 unsignedlong을 나타냅니다. 
Supported by the .NET Compact Framework VT_UI8 부호 없는 64비트 정수를 나타냅니다. 
Supported by the .NET Compact Framework VT_UINT unsigned 정수 값을 나타냅니다. 
Supported by the .NET Compact Framework VT_UNKNOWN IUnknown 포인터를 나타냅니다. 
Supported by the .NET Compact Framework VT_USERDEFINED 사용자 정의된 형식을 나타냅니다. 
Supported by the .NET Compact Framework VT_VARIANT VARIANT far 포인터를 나타냅니다. 
Supported by the .NET Compact Framework VT_VECTOR 셀 수 있는 단순한 배열을 나타냅니다. 
Supported by the .NET Compact Framework VT_VOID C 스타일 void를 나타냅니다. 

설명

System.Runtime.InteropServices.MarshalAsAttribute와 함께 사용되어 SafeArray의 요소 형식을 명시적으로 제어합니다.

예제

Imports System
Imports System.Runtime.InteropServices

Module MyModule
    ' If you do not have a type library for an interface
    ' you can redeclare it using ComImportAttribute.

    ' This is how the interface would look in an idl file.

    '[
    'object,
    'uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"),
    'dual,  helpstring("IMyStorage Interface"),
    'pointer_default(unique)
    ']
    'interface IMyStorage : IDispatch
    '{
    '   [id(1)]
    '   HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem);
    '   [id(2)]
    '   HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems);
    '   [id(3)]
    '   HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems);
    '   [id(4), propget]
    '   HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty);
    '};

    ' This is the managed declaration.

    <ComImport(), Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")> _
    Public Interface IMyStorage
        <DispId(1)> _
        Function GetItem(<InAttribute(), MarshalAs(UnmanagedType.BStr)> ByVal bstrName As String) _
           As <MarshalAs(UnmanagedType.Interface)> Object

        <DispId(2)> _
        Function GetItems(<InAttribute(), MarshalAs(UnmanagedType.BStr)> ByVal bstrLocation As String, _
           <OutAttribute(), MarshalAs(UnmanagedType.SafeArray)> ByVal Items() As Object)


        <DispId(3)> _
        Function GetItemDescriptions(<InAttribute()> ByVal bstrLocation As String, _
          <InAttribute(), OutAttribute(), MarshalAs(UnmanagedType.SafeArray)> ByRef varDescriptions() As Object)

        <DispId(4)> _
        ReadOnly Property IsEmpty(<MarshalAs(UnmanagedType.VariantBool)> ByVal bEmpty As Boolean)

    End Interface
End Module
using System;
using System.Runtime.InteropServices;

namespace MyModule
{
    // If you do not have a type library for an interface
    // you can redeclare it using ComImportAttribute.

    // This is how the interface would look in an idl file.

    //[
    //object,
    //uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"),
    //dual, helpstring("IMyStorage Interface"),
    //pointer_default(unique)
    //]
    //interface IMyStorage : IDispatch
    //{
    //  [id(1)]
    //  HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem);
    //  [id(2)]
    //  HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems);
    //  [id(3)]
    //  HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems);
    //  [id(4), propget]
    //  HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty);
    //};

    // This is the managed declaration.

    [ComImport]
    [Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")]
    public interface IMyStorage  
    {
        [DispId(1)]
        [return : MarshalAs( UnmanagedType.Interface )]
        Object GetItem( [In, MarshalAs( UnmanagedType.BStr )] String bstrName );

        [DispId(2)]
        void GetItems( [In, MarshalAs( UnmanagedType.BStr )] String bstrLocation, 
            [Out, MarshalAs( UnmanagedType.SafeArray, 
                      SafeArraySubType = VarEnum.VT_VARIANT )] out Object[] Items );
                
                
        [DispId(3)]
        void GetItemDescriptions( [In] String bstrLocation, 
            [In, Out, MarshalAs( UnmanagedType.SafeArray )] ref Object[] varDescriptions );

        bool IsEmpty 
        {
            [DispId(4)]
            [return : MarshalAs( UnmanagedType.VariantBool )]
            get;
        }
    }
}
using namespace System;
using namespace System::Runtime::InteropServices;

// If you do not have a type library for an interface
// you can redeclare it using ComImportAttribute.
// This is how the interface would look in an idl file.
//[
//object,
//uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"),
//dual, helpstring("IMyStorage Interface"),
//pointer_default(unique)
//]
//interface IMyStorage : IDispatch
//{
// [id(1)]
// HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem);
// [id(2)]
// HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems);
// [id(3)]
// HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems);
// [id(4), propget]
// HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty);
//};
// This is the managed declaration.

[ComImport]
[Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")]
interface class IMyStorage
{
   [DispId(1)]
   Object^ GetItem( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrName );

   //[return : MarshalAs(UnmanagedType::Interface)]

   [DispId(2)]
   void GetItems( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrLocation, [Out,MarshalAs(UnmanagedType::SafeArray,
   SafeArraySubType=VarEnum::VT_VARIANT)]array<Object^>^Items );

   [DispId(3)]
   void GetItemDescriptions( [In]String^ bstrLocation, [In,Out,MarshalAs(UnmanagedType::SafeArray)]array<Object^>^varDescriptions );

   property bool IsEmpty 
   {
      [DispId(4)]
      [returnvalue:MarshalAs(UnmanagedType::VariantBool)]
      bool get();
   }
};
import System.*;
import System.Runtime.InteropServices.*;
   
    // If you do not have a type library for an interface
    // you can redeclare it using ComImportAttribute.
    // This is how the interface would look in an idl file.
    // [
    // object,
    // uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"),
    // dual,    helpstring("IMyStorage Interface"),
    // pointer_default(unique)
    // ]
    // interface IMyStorage : IDispatch
    // {
    //    [id(1)]
    //    HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem);
    //    [id(2)]
    //    HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems);
    //    [id(3)]
    //    HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems);
    //    [id(4), propget]
    //    HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty);
    // };
    //  This is the managed declaration.
    /** @attribute ComImport()
     */
    /** @attribute Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")
     */
   public interface IMyStorage
   {
        /** @attribute DispId(1)
         */
        Object GetItem(
        /** @attribute In()
            @attribute MarshalAs(UnmanagedType.BStr)
         */String bstrName);
      
      
        /** @attribute DispId(2)
         */
        void GetItems(
        /** @attribute In()
            @attribute MarshalAs(UnmanagedType.BStr)
         */String bstrLocation,
        /** @attribute Out()
            @attribute MarshalAs(UnmanagedType.SafeArray, 
            SafeArraySubType = VarEnum.VT_VARIANT)
         */Object Items[]);
             
        /** @attribute DispId(3)
         */
        void GetItemDescriptions(
            /** @attribute In()
             */String bstrLocation,
            /** @attribute In()
                @attribute Out()
                @attribute MarshalAs(UnmanagedType.SafeArray)
             */Object varDescriptions[]);
               
        /** @attribute DispId(4)
         */
        /** @return MarshalAs(UnmanagedType.VariantBool)
         */
        boolean get_IsEmpty();
    } //IMyStorage

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0에서 지원

참고 항목

참조

System.Runtime.InteropServices 네임스페이스
SafeArray
MarshalAsAttribute 클래스