LCIDConversionAttributeとは? わかりやすく解説

LCIDConversionAttribute クラス

メソッドのアンマネージ シグネチャロケール識別子 (LCID) パラメータが必要であることを示します

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<AttributeUsageAttribute(AttributeTargets.Method, Inherited:=False)> _
Public NotInheritable Class
 LCIDConversionAttribute
    Inherits Attribute
Dim instance As LCIDConversionAttribute
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)]
 
public sealed class LCIDConversionAttribute
 : Attribute
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets::Method, Inherited=false)]
 
public ref class LCIDConversionAttribute sealed
 : public Attribute
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)
 */ 
public final class LCIDConversionAttribute
 extends Attribute
ComVisibleAttribute(true) 
AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)
 
public final class LCIDConversionAttribute
 extends Attribute
解説解説

この属性は、メソッド適用できます

この属性は、マーシャラが、指定されメソッド引数の後に LCID を渡すことを要求することを示しますマネージ コードからアンマネージ コードへの呼び出しが行われるときに、マーシャラが引数 LCID を自動的に指定します

使用例使用例

LCIDConversionAttribute指定されるさまざまなに応じてシグネチャ変化するようすを次の例に示します

Imports System
Imports System.Runtime.InteropServices
Imports System.Reflection

Class LCIDAttrSampler

    Const LCID_INSTALLED As Integer
 = 1
    Const LCID_SUPPORTED As Integer
 = 2

    <DllImport("KERNEL32.DLL", EntryPoint:="IsValidLocale",
 _
    SetLastError:=True, CharSet:=CharSet.Unicode, _
    CallingConvention:=CallingConvention.StdCall), _
    LCIDConversionAttribute(0)> _
    Public Shared Function
 IsValidLocale(ByVal dwFlags As Integer)
 As Boolean
    End Function

    Public Sub CheckCurrentLCID()
        Dim mthIfo As MethodInfo = Me.GetType().GetMethod("IsValidLocale")
        Dim attr As Attribute = Attribute.GetCustomAttribute(mthIfo,
 GetType(LCIDConversionAttribute))

        If Not(attr Is Nothing)
 Then
            Dim lcidAttr As LCIDConversionAttribute
 = CType(attr, LCIDConversionAttribute)
            Console.WriteLine("Position of the LCID argument in
 the unmanaged signature: " + lcidAttr.Value.ToString())
        End If

        Dim res As Boolean
 = IsValidLocale(LCID_INSTALLED)
        Console.WriteLine("Result LCID_INSTALLED "
 + res.ToString())
        res = IsValidLocale(LCID_SUPPORTED)
        Console.WriteLine("Result LCID_SUPPORTED "
 + res.ToString())
    End Sub

    Public Shared Sub Main()
        Dim smpl As LCIDAttrSampler = New
 LCIDAttrSampler()
        smpl.CheckCurrentLCID()
    End Sub

End Class

using System;
using System.Runtime.InteropServices;
using System.Reflection;

class LCIDAttrSample
{
    private const int LCID_INSTALLED
 = 1;
    private const int LCID_SUPPORTED
 = 2;

    [DllImport("KERNEL32.DLL", EntryPoint="IsValidLocale", SetLastError
 = true, CharSet = CharSet.Auto)]
    [LCIDConversionAttribute(0)] // Position of the LCID argument
    public static extern bool
 IsValidLocale(
                                                uint dwFlags            //
 options
                                            );

    public void CheckCurrentLCID()
    {
        MethodInfo mthIfo = this.GetType().GetMethod("IsValidLocale");
        Attribute attr = Attribute.GetCustomAttribute(mthIfo,typeof(LCIDConversionAttribute));

        if( attr != null)
        {
            LCIDConversionAttribute lcidAttr = (LCIDConversionAttribute)attr;
            Console.WriteLine("Position of the LCID argument in
 the unmanaged signature: " + lcidAttr.Value.ToString());
        }

        bool res = IsValidLocale(LCID_INSTALLED);
        Console.WriteLine("Result LCID_INSTALLED " + res.ToString());
        res = IsValidLocale(LCID_SUPPORTED);
        Console.WriteLine("Result LCID_SUPPORTED " + res.ToString());
    }

    static void Main(string[]
 args)
    {
        LCIDAttrSample smpl = new LCIDAttrSample();
        smpl.CheckCurrentLCID();
    }
}

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

#define LCID_INSTALLED 1
#define LCID_SUPPORTED 2

ref class LCIDAttrSample
{
public:

   // Position of the LCID argument

   [DllImport("KERNEL32.DLL",EntryPoint="IsValidLocale",SetLastError=true
,CharSet=CharSet::Auto)]
   [LCIDConversionAttribute(0)]
   static bool IsValidLocale( int
 dwFlags ); // options

   void CheckCurrentLCID()
   {
      MethodInfo^ mthIfo = this->GetType()->GetMethod( "IsValidLocale"
 );
      Attribute^ attr = Attribute::GetCustomAttribute( mthIfo, LCIDConversionAttribute::typeid
 );
      if ( attr != nullptr )
      {
         LCIDConversionAttribute^ lcidAttr = dynamic_cast<LCIDConversionAttribute^>(attr);
         Console::WriteLine( "Position of the LCID argument in
 the unmanaged signature: {0}", lcidAttr->Value );
      }

      bool res = IsValidLocale( LCID_INSTALLED );
      Console::WriteLine( "Result LCID_INSTALLED {0}", res );
      res = IsValidLocale( LCID_SUPPORTED );
      Console::WriteLine( "Result LCID_SUPPORTED {0}", res );
   }
};

int main()
{
   LCIDAttrSample^ smpl = gcnew LCIDAttrSample;
   smpl->CheckCurrentLCID();
}
import System.*;
import System.Runtime.InteropServices.*;
import System.Reflection.*;

class LCIDAttrSample
{
    private static final int
 LCID_INSTALLED = 1;
    private static final int
 LCID_SUPPORTED = 2;
    
    /** @attribute DllImport("KERNEL32.DLL", EntryPoint = "IsValidLocale"
,
        SetLastError = true, CharSet = CharSet.Auto) 
     */
    /** @attribute LCIDConversionAttribute(0)
     */
    
    public static native boolean IsValidLocale(int
 dwFlags);

    // Position of the LCID argument options
    public void CheckCurrentLCID()
    {
        MethodInfo mthIfo = this.GetType().GetMethod("IsValidLocale");
        Attribute attr = Attribute.GetCustomAttribute(mthIfo,
            LCIDConversionAttribute.class.ToType());
        if (attr != null) {
            LCIDConversionAttribute lcidAttr = (LCIDConversionAttribute)attr;
            Console.WriteLine("Position of the LCID argument in
 the unmanaged "
                + "signature: " 
                + System.Convert.ToString(lcidAttr.get_Value()));
        }

        boolean res = IsValidLocale(LCID_INSTALLED);
        Console.WriteLine("Result LCID_INSTALLED " 
            + System.Convert.ToString(res));
        res = IsValidLocale(LCID_SUPPORTED);
        Console.WriteLine("Result LCID_SUPPORTED " 
            + System.Convert.ToString(res));
    } //CheckCurrentLCID

    public static void main(String[]
 args)
    {
        LCIDAttrSample smpl = new LCIDAttrSample();
        smpl.CheckCurrentLCID();
    } //main
} //LCIDAttrSample
継承階層継承階層
System.Object
   System.Attribute
    System.Runtime.InteropServices.LCIDConversionAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LCIDConversionAttribute メンバ
System.Runtime.InteropServices 名前空間

LCIDConversionAttribute コンストラクタ

アンマネージ シグネチャ内での LCID の位置指定してLCIDConversionAttribute クラス新しインスタンス初期化します。

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim lcid As Integer

Dim instance As New LCIDConversionAttribute(lcid)
public LCIDConversionAttribute (
    int lcid
)
public:
LCIDConversionAttribute (
    int lcid
)
public LCIDConversionAttribute (
    int lcid
)
public function LCIDConversionAttribute (
    lcid : int
)

パラメータ

lcid

アンマネージ シグネチャ内での引数 LCID の位置示します。0 は、最初引数示します

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LCIDConversionAttribute クラス
LCIDConversionAttribute メンバ
System.Runtime.InteropServices 名前空間

LCIDConversionAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。 ( Attribute から継承されます。)
パブリック プロパティ Value アンマネージ シグネチャ内での引数 LCID の位置取得します
参照参照

関連項目

LCIDConversionAttribute クラス
System.Runtime.InteropServices 名前空間

LCIDConversionAttribute メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスハッシュ コード返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
参照参照

関連項目

LCIDConversionAttribute クラス
System.Runtime.InteropServices 名前空間

LCIDConversionAttribute メンバ

メソッドのアンマネージ シグネチャロケール識別子 (LCID) パラメータが必要であることを示します

LCIDConversionAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド LCIDConversionAttribute アンマネージ シグネチャ内での LCID の位置指定してLCIDConversionAttribute クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。(Attribute から継承されます。)
パブリック プロパティ Value アンマネージ シグネチャ内での引数 LCID の位置取得します
パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスハッシュ コード返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
参照参照

関連項目

LCIDConversionAttribute クラス
System.Runtime.InteropServices 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からLCIDConversionAttributeを検索した結果を表示しています。
Weblioに収録されているすべての辞書からLCIDConversionAttributeを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からLCIDConversionAttribute を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「LCIDConversionAttribute」の関連用語

LCIDConversionAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



LCIDConversionAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS