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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > NeutralResourcesLanguageAttributeの意味・解説 

NeutralResourcesLanguageAttribute クラス

アセンブリのニュートラル カルチャの ResourceManager を通知します。このクラスは継承できません。

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

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

NeutralResourcesLanguageAttribute クラスを使用する例を次に示します。

Imports System
Imports System.Resources
Imports System.Globalization
Imports System.Threading



<assembly: NeutralResourcesLanguageAttribute("de",
 UltimateResourceFallbackLocation.Satellite)>
 

Public Class Demo
   
    Public Overloads Shared
 Sub Main(ByVal args() As
 String)

        ' If a specific culture is passed in through the command line,
 use that -- otherwise
        ' just use the current ui culture
        Dim strCulture As String
 = ""
        If args.Length = 1 Then
            strCulture = args(0)
        End If
        If strCulture <> ""
 Then
            Try
                Thread.CurrentThread.CurrentUICulture = New CultureInfo(strCulture)
            Catch e As ArgumentException
                Console.WriteLine(e.Message, "Bad command-line
 argument")
            End Try
        Else
            Console.WriteLine("Current culture is: {0}",
 CultureInfo.CurrentUICulture.ToString())
        End If
        Dim rm As ResourceManager

        Try
            rm = New ResourceManager("MyStrings",
 GetType(Demo).Assembly)
            Dim attr As New
 NeutralResourcesLanguageAttribute("de", UltimateResourceFallbackLocation.Satellite)
            Console.WriteLine(("Neutral language = "
 + rm.GetString("Language") + ",
 Fallback location = " + attr.Location.ToString() + ", Fallback culture = " + attr.CultureName.ToString()))
            Console.WriteLine(rm.GetString("MSG"))

        Catch e As MissingSatelliteAssemblyException
            Console.WriteLine(e.Message, "Unable to locate satellite
 Assembly")
        End Try
    End Sub 'Main 
End Class 'Demo 


using System;
using System.Resources;
using System.Globalization;
using System.Threading;

[assembly: NeutralResourcesLanguageAttribute("de" , UltimateResourceFallbackLocation.Satellite)]

public class Demo
{
        public static void
 Main(string[] args) {
            
            // If a specific culture is passed in through the command
 line, use that -- otherwise
            // just use the current ui culture
        
            String strCulture = "";
            if (args.Length == 1) 
            {
                strCulture = args[0];
            }
        if (strCulture != "") 
        {
            try {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(strCulture);
            }
            catch (ArgumentException e){
                Console.WriteLine(e.Message, "Bad command-line argument");
            }
        }
        else
            Console.WriteLine("Current culture is: {0}", CultureInfo.CurrentUICulture.ToString());

        ResourceManager rm;

        try
        {
            rm = new ResourceManager("MyStrings", typeof(Demo).Assembly);
            NeutralResourcesLanguageAttribute attr = new NeutralResourcesLanguageAttribute("de",
 UltimateResourceFallbackLocation.Satellite);
            Console.WriteLine("Neutral language = " + rm.GetString("Language")
 + ", Fallback location = " + attr.Location.ToString() + ", Fallback
 culture = " + attr.CultureName.ToString());
            Console.WriteLine(rm.GetString("MSG"));

        }
        catch (MissingSatelliteAssemblyException e){
            Console.WriteLine(e.Message, "Unable to locate satellite Assembly");
        }



        }

}
using namespace System;
using namespace System::Resources;
using namespace System::Globalization;
using namespace System::Threading;

[assembly:NeutralResourcesLanguageAttribute("de",UltimateResourceFallbackLocation::Satellite)];
public ref class Demo
{
public:
   int FallbackDemo()
   {
      array<String^>^args = Environment::GetCommandLineArgs();
      
      // If a specific culture is passed in through the command line,
 use that -- otherwise
      // just use the current ui culture
      String^ strCulture = L"";
      if ( args->Length == 1 )
      {
         strCulture = args[ 0 ];
      }

      if (  !strCulture->Equals( L"" ) )
      {
         try
         {
            Thread::CurrentThread->CurrentUICulture = gcnew CultureInfo( strCulture
 );
         }
         catch ( ArgumentException^ e ) 
         {
            Console::WriteLine( e->Message, L"Bad command-line argument"
 );
         }

      }
      else
            Console::WriteLine( L"Current culture is: {0}", CultureInfo::CurrentUICulture
 );

      ResourceManager^ rm;
      try
      {
         
         rm = gcnew ResourceManager( L"MyStrings",Demo::typeid->Assembly
 );
         NeutralResourcesLanguageAttribute^ attr = gcnew NeutralResourcesLanguageAttribute(
 L"de",UltimateResourceFallbackLocation::Satellite );
         
         Console::WriteLine( L"Neutral language = {0}, Fallback location = {1},
 Fallback culture = {2}", rm->GetString( L"Language" ), attr->Location,
 attr->CultureName );
         Console::WriteLine( rm->GetString( L"MSG" ) );
      }
      catch ( MissingSatelliteAssemblyException^ e ) 
      {
         Console::WriteLine( e->Message, L"Unable to locate satellite Assembly"
 );
      }

      return 1;
   }

};

void main()
{
   Demo^ d = gcnew Demo;
   d->FallbackDemo();
}

import System.*;
import System.Resources.*;
import System.Globalization.*;
import System.Threading.*;

/** @assembly NeutralResourcesLanguageAttribute("de",
    UltimateResourceFallbackLocation.Satellite)
 */
public class Demo
{
    public static void main(String[]
 args)
    {
        // If a specific culture is passed in through the command line,
 use
        // that -- otherwise just use the current ui culture
        String strCulture = "";
        if (args.get_Length() == 1) {
            strCulture = args[0];
        }
        if (!(strCulture.Equals(""))) {
            try {
                System.Threading.Thread.get_CurrentThread().
                    set_CurrentUICulture(new CultureInfo(strCulture));
            }
            catch (ArgumentException e) {
                Console.WriteLine(e.get_Message(), "Bad command-line argument");
            }
        }
        else {
            Console.WriteLine("Current culture is: {0}",
                CultureInfo.get_CurrentUICulture().ToString());
        }
        ResourceManager rm;
        try {
            rm = new ResourceManager("MyStrings",
                Demo.class.ToType().get_Assembly());
            NeutralResourcesLanguageAttribute attr = 
                new NeutralResourcesLanguageAttribute("de"
,
                UltimateResourceFallbackLocation.Satellite);
            Console.WriteLine("Neutral language = " 
                + rm.GetString("Language") + ", Fallback location
 = " 
                + attr.get_Location().ToString() + ", Fallback culture = "
 
                + attr.get_CultureName().ToString());
            Console.WriteLine(rm.GetString("MSG"));
        }
        catch (MissingSatelliteAssemblyException e) {
            Console.WriteLine(e.get_Message(),
                "Unable to locate satellite Assembly");
        }
    } //main
} //Demo
継承階層継承階層
System.Object
   System.Attribute
    System.Resources.NeutralResourcesLanguageAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NeutralResourcesLanguageAttribute メンバ
System.Resources 名前空間
UltimateResourceFallbackLocation
FallbackLocation
その他の技術情報
リソースのパッケージ化と配置

NeutralResourcesLanguageAttribute コンストラクタ (String, UltimateResourceFallbackLocation)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

指定した最終的なリソース フォールバック位置で、NeutralResourcesLanguageAttribute クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    cultureName As String, _
    location As UltimateResourceFallbackLocation _
)
Dim cultureName As String
Dim location As UltimateResourceFallbackLocation

Dim instance As New NeutralResourcesLanguageAttribute(cultureName,
 location)
public NeutralResourcesLanguageAttribute (
    string cultureName,
    UltimateResourceFallbackLocation location
)
public:
NeutralResourcesLanguageAttribute (
    String^ cultureName, 
    UltimateResourceFallbackLocation location
)
public NeutralResourcesLanguageAttribute (
    String cultureName, 
    UltimateResourceFallbackLocation location
)
public function NeutralResourcesLanguageAttribute
 (
    cultureName : String, 
    location : UltimateResourceFallbackLocation
)

パラメータ

cultureName

現在のアセンブリのニュートラル リソースが書き込まれたカルチャの名前。

location

ニュートラル フォールバック リソースを取得する場所を示す UltimateResourceFallbackLocation 列挙体値。

例外例外
例外の種類条件

ArgumentNullException

cultureName が null 参照 (Visual Basic では Nothing) です。

ArgumentException

location が UltimateResourceFallbackLocation のメンバではありません。

解説解説

NeutralResourcesLanguageAttribute コンストラクタを UltimateResourceFallbackLocation 列挙体と共に使用して、ResourceManager クラスでニュートラル フォールバック リソースをメイン アプリケーション アセンブリ (既定) から取得するか、または CurrentUICulture プロパティおよび FallbackLocation プロパティによって指定されたサテライト アセンブリから取得するかを指定します。

カルチャの有効な名前の詳細については、「CultureInfo」を参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
NeutralResourcesLanguageAttribute クラス
NeutralResourcesLanguageAttribute メンバ
System.Resources 名前空間
UltimateResourceFallbackLocation
FallbackLocation
その他の技術情報
リソースのパッケージ化と配置

NeutralResourcesLanguageAttribute コンストラクタ (String)

NeutralResourcesLanguageAttribute クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    cultureName As String _
)
Dim cultureName As String

Dim instance As New NeutralResourcesLanguageAttribute(cultureName)
public NeutralResourcesLanguageAttribute (
    string cultureName
)
public:
NeutralResourcesLanguageAttribute (
    String^ cultureName
)
public NeutralResourcesLanguageAttribute (
    String cultureName
)
public function NeutralResourcesLanguageAttribute
 (
    cultureName : String
)

パラメータ

cultureName

現在のアセンブリのニュートラル リソースが書き込まれたカルチャの名前。

例外例外
例外の種類条件

ArgumentNullException

cultureName パラメータが null 参照 (Visual Basic では Nothing) です。

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

NeutralResourcesLanguageAttribute コンストラクタ

NeutralResourcesLanguageAttribute クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
NeutralResourcesLanguageAttribute (String) NeutralResourcesLanguageAttribute クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

NeutralResourcesLanguageAttribute (String, UltimateResourceFallbackLocation) 指定した最終的なリソース フォールバック位置で、NeutralResourcesLanguageAttribute クラスの新しいインスタンスを初期化します。
参照参照

関連項目

NeutralResourcesLanguageAttribute クラス
NeutralResourcesLanguageAttribute メンバ
System.Resources 名前空間

NeutralResourcesLanguageAttribute プロパティ


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

参照参照

関連項目

NeutralResourcesLanguageAttribute クラス
System.Resources 名前空間
UltimateResourceFallbackLocation
FallbackLocation

その他の技術情報

リソースのパッケージ化と配置

NeutralResourcesLanguageAttribute メソッド


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

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

関連項目

NeutralResourcesLanguageAttribute クラス
System.Resources 名前空間
UltimateResourceFallbackLocation
FallbackLocation

その他の技術情報

リソースのパッケージ化と配置

NeutralResourcesLanguageAttribute メンバ

アセンブリのニュートラル カルチャの ResourceManager を通知します。このクラスは継承できません。

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


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

関連項目

NeutralResourcesLanguageAttribute クラス
System.Resources 名前空間
UltimateResourceFallbackLocation
FallbackLocation

その他の技術情報

リソースのパッケージ化と配置



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「NeutralResourcesLanguageAttribute」の関連用語

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

   

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



NeutralResourcesLanguageAttributeのページの著作権

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

©2026 GRAS Group, Inc.RSS