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

ResourceManager クラス

カルチャ固有のリソースに、実行時に簡単にアクセスできるようにします。

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

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class ResourceManager
Dim instance As ResourceManager
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public class ResourceManager
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class ResourceManager
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class ResourceManager
SerializableAttribute 
ComVisibleAttribute(true) 
public class ResourceManager
解説解説

ResourceManager クラスは、カルチャ固有のリソースを検索し、ローカライズされたリソースが存在しない場合は代替となるリソースを提供し、リソースのシリアル化をサポートします。

ResourceManager のメソッドを使用すると、呼び出し元は GetObject メソッドと GetString メソッドを使用して、特定カルチャのリソースにアクセスできるようになります。既定では、これらのメソッドは、呼び出したスレッドの現在のカルチャ設定で決定されているカルチャに固有のリソースを返します。詳細については、Thread.CurrentUICulture のトピックを参照してください。呼び出し元で ResourceManager.GetResourceSet メソッドを使用すると、カルチャ フォールバック規則を無視し、特定のカルチャのリソースを表す ResourceSet を取得できます。取得した ResourceSet を使用して、そのカルチャ用にローカライズされているリソースに名前でアクセスできます。

理想的には、すべての言語のリソースを作成する必要があります。または、少なくとも 1 つ、言語のわかりやすいサブセットを作成する必要があります。リソース ファイル名は basename.cultureName.resources の名前付け規則に従います。basename は、アプリケーション名か、実行単位によって異なりますが、クラス名です。CultureInfo の Name プロパティを使用して cultureName が決定されます。ニュートラル カルチャ (InvariantCulture で返されます) に使用するリソースの名前は、basename.resources にする必要があります。

たとえば、アセンブリに複数のリソースがあり、これがリソース ファイルに格納されていて、リソース ファイルの basename が "MyResources" だと想定します。これらのリソース ファイルの名前は、"MyResources.ja-JP.resources"、"MyResources.de.resources"、"MyResources.zh-CHS.resources"、"MyResources.fr-BE.resources" などのようになり、日本語、ドイツ語、繁体字中国語、フランス語 (ベルギー) の各リソースが含まれます。既定のリソース ファイルの名前は MyResources.resources です。カルチャ固有のリソース ファイルは、通常、カルチャごとのサテライト アセンブリにパッケージ化されます。既定のリソース ファイルはメイン アセンブリに入れる必要があります。

この basename を持つリソースを表すために ResourceManager が作成されているとします。ResourceManager を使用して、"MyResources.ja-JP.resources" をカプセル化する ResourceSet を取得できます。この場合は、GetResourceSet(new CultureInfo ("ja-JP"), TRUE, FALSE) のようにメソッドを呼び出します。また、"MyResources" に "TOOLBAR_ICON" という名前のリソースが含まれていることがわかっている場合は、日本語にローカライズしたこのリソースの値を取得できます。この場合は、GetObject("TOOLBAR_ICON", new CultureInfo("ja-JP")) のようにメソッドを呼び出します。

ResourceManager のほとんどの基本的な用途では必ずしも必要ではありませんが、一般に出荷するアセンブリでは、SatelliteContractVersionAttribute を使用して、サテライトを再配置せずにメイン アセンブリのバージョン管理をサポートし、NeutralResourcesLanguageAttribute を使用して、存在しないサテライト アセンブリの検索を防止する必要があります。

サテライト アセンブリのバージョン管理サポートの詳細については、サテライト アセンブリに含まれるリソースの取得 のトピックを参照してください。サテライト アセンブリの作成の詳細については、「サテライト アセンブリの作成」を参照してください。Windows フォーム ダイアログのローカリゼーションの支援については、Microsoft .NET Framework SDK の「Windows フォーム リソース エディタ (Winres.exe)」ツールを参照してください。

リソースの設定と作成の詳細については、「アプリケーションのリソース」を参照してください。

注意に関するメモメモ

<satelliteassemblies> ノードを作成する代わりに、ClickOnce 配置マニフェスト 機能を使用することもできます。

次のコード例に従って、構成ファイル セクションを作成します。

<?xml version ="1.0"?>
<configuration>
    <satelliteassemblies>
        <assembly name="MainAssemblyName, Version=versionNumber, Culture=neutral,
 PublicKeyToken=null|yourPublicKeyToken">
            <culture>cultureName1</culture>
            <culture>cultureName2</culture>
            <culture>cultureName3</culture>
        </assembly>
    </satelliteassemblies>
</configuration>

構成ファイル内で次の作業を行います。

<satelliteassemblies> ノードに列挙されていないアセンブリでリソースが必要な場合、ResourceManager クラスは、標準の調査規則に従ってカルチャを調査します。

使用例使用例

明示的なカルチャと現在の暗黙の UI カルチャを使用して、メイン アセンブリとサテライト アセンブリから文字列リソースを取得するコード例を次に示します。詳細については、「サテライト アセンブリの作成」のサブトピック「グローバル アセンブリ キャッシュ内にインストールしないサテライト アセンブリ用のディレクトリの位置」を参照してください。

' This code example demonstrates the ResourceManager() 
' constructor and ResourceManager.GetString() method.

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

'
'Perform the following steps to use this code example:
'
'Main assembly:
'1) In a main directory, create a file named "rmc.txt" that
 
'contains the following resource strings:
'
'day=Friday
'year=2006
'holiday="Cinco de Mayo"
'
'2) Use the resgen.exe tool to generate the "rmc.resources"
 
'resource file from the "rmc.txt" input file.
'
'> resgen rmc.txt
'
'Satellite Assembly:
'3) Create a subdirectory of the main directory and name the 
'subdirectory "es-ES", which is the culture name of the 
'satellite assembly.
'
'4) Create a file named "rmc.es-ES.txt" that contains the
 
'following resource strings:
'
'day=Viernes
'year=2006
'holiday="Cinco de Mayo"
'
'5) Use the resgen.exe tool to generate the "rmc.es-ES.resources"
 
'resource file from the "rmc.es-ES.txt" input file.
'
'> resgen rmc.es-ES.txt
'
'6) Use the al.exe tool to create a satellite assembly. If the 
'base name of the application is "rmc", the satellite assembly
 
'name must be "rmc.resources.dll". Also, specify the culture,
 
'which is es-ES.
'
'> al /embed:rmc.es-ES.resources /c:es-ES /out:rmc.resources.dll
 
'
'7) Assume the filename for this code example is "rmc.vb".
 Compile 
'rmc.vb and embed the main assembly resource file, rmc.resources, in
 
'the executable assembly, rmc.exe:
'
'>vbc /res:rmc.resources rmc.vb
'
'8) Execute rmc.exe, which obtains and displays the embedded 
'resource strings.
'

Class Sample
    Public Shared Sub Main()
 
        Dim day As String
        Dim year As String
        Dim holiday As String
        Dim celebrate As String
 = "{0} will occur on {1} in {2}." & vbCrLf
        
        ' Create a resource manager. The GetExecutingAssembly() method
        ' gets rmc.exe as an Assembly object.
        Dim rm As New ResourceManager("rmc",
 [Assembly].GetExecutingAssembly())
        
        ' Obtain resources using the current UI culture.
        Console.WriteLine("Obtain resources using the current
 UI culture.")
        
        ' Get the resource strings for the day, year, and holiday 
        ' using the current UI culture. Use those strings to 
        ' display a message.
        day = rm.GetString("day")
        year = rm.GetString("year")
        holiday = rm.GetString("holiday")
        Console.WriteLine(celebrate, holiday, day, year)
        
        ' Obtain the es-ES culture.
        Dim ci As New CultureInfo("es-ES")
        
        ' Get the resource strings for the day, year, and holiday 
        ' using the specified culture. Use those strings to 
        ' display a message. 
        ' Obtain resources using the es-ES culture.
        Console.WriteLine("Obtain resources using the es-ES culture.")
        
        day = rm.GetString("day", ci)
        year = rm.GetString("year", ci)
        holiday = rm.GetString("holiday", ci)
        
        ' ---------------------------------------------------------------
        ' Alternatively, comment the preceding 3 code statements and
 
        ' uncomment the following 4 code statements:
        ' ----------------------------------------------------------------
        ' Set the current UI culture to "es-ES" (Spanish-Spain).
        '    Thread.CurrentThread.CurrentUICulture = ci
        ' Get the resource strings for the day, year, and holiday 
        ' using the current UI culture. Use those strings to 
        ' display a message. 
        '    day  = rm.GetString("day")
        '    year = rm.GetString("year")
        '    holiday = rm.GetString("holiday")
        ' ---------------------------------------------------------------
        ' Regardless of the alternative that you choose, display a message
 
        ' using the retrieved resource strings.
        Console.WriteLine(celebrate, holiday, day, year)
    
    End Sub 'Main
End Class 'Sample

'
'This code example produces the following results:
'
'>rmc
'Obtain resources using the current UI culture.
'"5th of May" will occur on Friday in 2006.
'
'Obtain resources using the es-ES culture.
'"Cinco de Mayo" will occur on Viernes in 2006.
'
// This code example demonstrates the ResourceManager() 
// constructor and ResourceManager.GetString() method.

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

/*
Perform the following steps to use this code example:

Main assembly:
1) In a main directory, create a file named "rmc.txt" that 
contains the following resource strings:

day=Friday
year=2006
holiday="Cinco de Mayo"

2) Use the resgen.exe tool to generate the "rmc.resources" 
resource file from the "rmc.txt" input file.

> resgen rmc.txt

Satellite Assembly:
3) Create a subdirectory of the main directory and name the 
subdirectory "es-ES", which is the culture name of the 
satellite assembly.

4) Create a file named "rmc.es-ES.txt" that contains the 
following resource strings:

day=Viernes
year=2006
holiday="Cinco de Mayo"

5) Use the resgen.exe tool to generate the "rmc.es-ES.resources" 
resource file from the "rmc.es-ES.txt" input file.

> resgen rmc.es-ES.txt

6) Use the al.exe tool to create a satellite assembly. If the 
base name of the application is "rmc", the satellite
 assembly 
name must be "rmc.resources.dll". Also, specify the culture, 
which is es-ES.

> al /embed:rmc.es-ES.resources /c:es-ES /out:rmc.resources.dll 

7) Assume the filename for this code example
 is "rmc.cs". Compile 
rmc.cs and embed the main assembly resource file, rmc.resources, in
 
the executable assembly, rmc.exe:

>csc /res:rmc.resources rmc.cs

8) Execute rmc.exe, which obtains and displays the embedded 
resource strings.
*/

class Sample 
{
    public static void Main()
 
    {
    string day;
    string year;
    string holiday;
    string celebrate = "{0} will occur on {1} in
 {2}.\n";

// Create a resource manager. The GetExecutingAssembly() method
// gets rmc.exe as an Assembly object.

    ResourceManager rm = new ResourceManager("rmc",
 
                             Assembly.GetExecutingAssembly());

// Obtain resources using the current UI culture.
    Console.WriteLine("Obtain resources using the current
 UI culture.");

// Get the resource strings for the day, year, and holiday 
// using the current UI culture. Use those strings to 
// display a message.

    day  = rm.GetString("day");
    year = rm.GetString("year");
    holiday = rm.GetString("holiday");
    Console.WriteLine(celebrate, holiday, day, year);

// Obtain the es-ES culture.
    CultureInfo ci = new CultureInfo("es-ES");

// Get the resource strings for the day, year, and holiday 
// using the specified culture. Use those strings to 
// display a message. 

// Obtain resources using the es-ES culture.
    Console.WriteLine("Obtain resources using the es-ES culture.");

    day  = rm.GetString("day", ci);
    year = rm.GetString("year", ci);
    holiday = rm.GetString("holiday", ci);

// ---------------------------------------------------------------
// Alternatively, comment the preceding 3 code statements and 
// uncomment the following 4 code statements:
// ----------------------------------------------------------------

// Set the current UI culture to "es-ES" (Spanish-Spain).
//    Thread.CurrentThread.CurrentUICulture = ci;

// Get the resource strings for the day, year, and holiday 
// using the current UI culture. Use those strings to 
// display a message. 
//    day  = rm.GetString("day");
//    year = rm.GetString("year");
//    holiday = rm.GetString("holiday");
// ---------------------------------------------------------------

// Regardless of the alternative that you choose, display a message
 
// using the retrieved resource strings.
    Console.WriteLine(celebrate, holiday, day, year);
    }
}

/*
This code example produces the following results:

>rmc
Obtain resources using the current UI culture.
"5th of May" will occur on Friday in 2006.

Obtain resources using the es-ES culture.
"Cinco de Mayo" will occur on Viernes in 2006.

*/
継承階層継承階層
System.Object
  System.Resources.ResourceManager
     System.ComponentModel.ComponentResourceManager
スレッド セーフスレッド セーフ

この型は、マルチスレッド操作に対して安全です。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ResourceManager コンストラクタ ()


ResourceManager コンストラクタ (Type)

指定した Type の情報に基づいて、サテライト アセンブリでリソースを検索する ResourceManager を作成します。

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

Public Sub New ( _
    resourceSource As Type _
)
Dim resourceSource As Type

Dim instance As New ResourceManager(resourceSource)
public ResourceManager (
    Type resourceSource
)
public:
ResourceManager (
    Type^ resourceSource
)
public ResourceManager (
    Type resourceSource
)
public function ResourceManager (
    resourceSource : Type
)

パラメータ

resourceSource

ResourceManager が .resources ファイルを検索するために必要な全情報を取得する元となる Type。

例外例外
例外の種類条件

ArgumentNullException

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

解説解説

ResourceManager は、.resources ファイルのアセンブリ、基本名、および名前空間を Type から推論します。ResourceManager は、サテライト アセンブリが使用され、既定の ResourceSet クラスが使用されるものと仮定します。MyCompany.MyProduct.MyType のような型が指定されると、ResourceManager は、"MyCompany.MyProduct.MyType.[culture name.]resources" という (メイン アセンブリとサテライト アセンブリの) .resources ファイルを、MyType が定義されているアセンブリで検索します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ResourceManager コンストラクタ (String, Assembly, Type)

指定したルート名から派生したファイルに含まれているリソースを検索する ResourceManager クラスの新しいインスタンスを、指定した Assembly を使用して初期化します。

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

Public Sub New ( _
    baseName As String, _
    assembly As Assembly,
 _
    usingResourceSet As Type _
)
Dim baseName As String
Dim assembly As Assembly
Dim usingResourceSet As Type

Dim instance As New ResourceManager(baseName,
 assembly, usingResourceSet)
public ResourceManager (
    string baseName,
    Assembly assembly,
    Type usingResourceSet
)
public:
ResourceManager (
    String^ baseName, 
    Assembly^ assembly, 
    Type^ usingResourceSet
)
public ResourceManager (
    String baseName, 
    Assembly assembly, 
    Type usingResourceSet
)
public function ResourceManager (
    baseName : String, 
    assembly : Assembly, 
    usingResourceSet : Type
)

パラメータ

baseName

リソースのルート名。たとえば、"MyResource.en-US.resources" というリソース ファイルのルート名は "MyResource" です。

assembly

リソースのメイン Assembly。

usingResourceSet

使用するカスタム ResourceSet の Type。null 参照 (Visual Basic では Nothing) の場合は、既定のランタイム ResourceSet が使用されます。

例外例外
例外の種類条件

ArgumentException

usingResourceset が ResourceSet の派生クラスではありません。

ArgumentNullException

baseName パラメータまたは assembly パラメータが null 参照 (Visual Basic では Nothing) です。

解説解説

それぞれのリソース ファイルは、サテライト アセンブリに含める必要があります。インバリアント カルチャの .resources ファイルはメイン アセンブリに含めます。サテライト アセンブリは、そのアセンブリのマニフェストで指定されている単一カルチャのリソースを含んでいるものと見なされ、必要に応じて読み込まれます。

使用する ResourceSet 実装を指定できます。特定の ResourceSet を実装する必要がなくても、カスタム リソース ファイル形式を使用する場合は、ResourceSet クラスから派生させ、GetDefaultReader と GetDefaultWriter をオーバーライドし、その型をこのコンストラクタに渡します。

メモメモ

usingResourceSet パラメータを使用して、独自のリソース形式をサポートします。通常は null 参照 (Visual Basic では Nothing) です。これは、Type だけをとるコンストラクタとは異なります。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ResourceManager コンストラクタ


ResourceManager コンストラクタ (String, Assembly)

指定したルート名から派生したファイルに含まれているリソースを検索する ResourceManager クラスの新しいインスタンスを、指定した Assembly を使用して初期化します。

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

例外例外
例外の種類条件

ArgumentNullException

baseName パラメータまたは assembly パラメータが null 参照 (Visual Basic では Nothing) です。

解説解説

それぞれのリソース ファイルは、サテライト アセンブリに含める必要があります。インバリアント カルチャの .resources ファイルはメイン アセンブリに含めます。サテライト アセンブリは、そのアセンブリのマニフェストで指定されている単一カルチャのリソースを含んでいるものと見なされ、必要に応じて読み込まれます。

このコンストラクタは、システム提供の ResourceSet 実装を使用します。カスタム リソース ファイル形式を使用するには、ResourceSet クラスから派生させ、GetDefaultReader と GetDefaultWriter をオーバーライドし、3 番目のパラメータとして Type をとるコンストラクタにその型を渡します。カスタム ResourceSet を使用すると、リソースのキャッシュ ポリシーの制御、または独自のリソース ファイル形式のサポートのために役立つことがありますが、通常は必要ありません。

使用例使用例
Imports System
Imports System.Globalization
Imports System.Threading
Imports System.Resources
Imports System.Reflection

Class ResourcesExample
   
    Public Shared Sub Main()
        ' Create a resource manager to retrieve resources.
        Dim rm As New ResourceManager("items",
 _
           [Assembly].GetExecutingAssembly())
       
        ' Get the culture of the currently executing thread.
        ' The value of ci will determine the culture of
        ' the resources that the resource manager retrieves.
        Dim ci As CultureInfo = Thread.CurrentThread.CurrentCulture
      
        ' Retrieve the value of the string resource named 
        ' "welcome" localized for the culture specified by
 ci.
        Dim str As [String] = rm.GetString("welcome",
 ci)
        Console.WriteLine(str)
    End Sub
End Class
using System;
using System.Globalization;
using System.Threading;
using System.Resources;
using System.Reflection;

class ResourcesExample 
{
    public static void Main()
 
    {
       // Create a resource manager to retrieve resources.
       ResourceManager rm = new ResourceManager("items",
 
          Assembly.GetExecutingAssembly());

       // Get the culture of the currently executing thread.
       // The value of ci will determine the culture of
       // the resources that the resource manager retrieves.
       CultureInfo ci = Thread.CurrentThread.CurrentCulture;
        
       // Retrieve the value of the string resource named 
       // "welcome", localized for the culture specified by
 ci.
       String str = rm.GetString("welcome", ci);
       Console.WriteLine(str);
    }
}
using namespace System;
using namespace System::Globalization;
using namespace System::Threading;
using namespace System::Resources;
using namespace System::Reflection;
int main()
{
   
   // Create a resource manager to retrieve resources.
   ResourceManager^ rm = gcnew ResourceManager( "items",Assembly::GetExecutingAssembly()
 );
   
   // Get the culture of the currently executing thread.
   // The value of ci will determine the culture of
   // the resources that the resource manager retrieves.
   CultureInfo^ ci = Thread::CurrentThread->CurrentCulture;
   
   // Retrieve the value of the string resource named
   // S"welcome", localized for the culture specified by ci.
   String^ str = rm->GetString( "welcome", ci );
   Console::WriteLine( str );
}

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

class ResourcesExample
{

    public static void main(String[]
 args)
    {
        // Create a resource manager to retrieve resources.
        ResourceManager rm = new ResourceManager("items",
 
            Assembly.GetExecutingAssembly());

        // Get the culture of the currently executing thread.
        // The value of ci will determine the culture of
        // the resources that the resource manager retrieves.
        CultureInfo ci = 
            System.Threading.Thread.get_CurrentThread().get_CurrentCulture();

        // Retrieve the value of the string resource named 
        // "welcome", localized for the culture specified by
 ci.
        String str = rm.GetString("welcome", ci);
        Console.WriteLine(str);
    } //main
} //ResourcesExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ResourceManager フィールド


パブリック フィールドパブリック フィールド

プロテクト フィールドプロテクト フィールド
  名前 説明
プロテクト フィールド BaseNameField ResourceManager が、リソースを検索するリソース ファイルのルート名を示します。
プロテクト フィールド MainAssembly リソースを含むメイン Assembly を示します。
プロテクト フィールド ResourceSets カルチャから ResourceSet オブジェクトへの割り当てを返す Hashtable を格納します。
参照参照

関連項目

ResourceManager クラス
System.Resources 名前空間
CultureInfo
SatelliteContractVersionAttribute

その他の技術情報

エンコーディングとローカリゼーション

ResourceManager プロパティ


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

( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ ResourceSetType ResourceManager が ResourceSet オブジェクトを生成するために使用する ResourceSet の Type を取得します。
プロテクト プロパティプロテクト プロパティ
参照参照

関連項目

ResourceManager クラス
System.Resources 名前空間
CultureInfo
SatelliteContractVersionAttribute

その他の技術情報

エンコーディングとローカリゼーション

ResourceManager メソッド


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

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CreateFileBasedResourceManager アセンブリ マニフェストではなく、リソースの特定のディレクトリを検索する ResourceManager を返します。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetObject オーバーロードされます。 現在の設定に対して指定されている Object リソースの値を取得します。
パブリック メソッド GetResourceSet 特定のカルチャに使用する ResourceSet を取得します。
パブリック メソッド GetStream オーバーロードされます。 MemoryStream から UnmanagedMemoryStream を返します。
パブリック メソッド GetString オーバーロードされます。 指定したカルチャまたは現在の暗黙の UI カルチャの指定した String リソースを取得します。
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ReleaseAllResources すべての ResourceSet オブジェクトの Close を呼び出し、すべてのリソースを解放するように ResourceManager に指示します。
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Finalize  Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。)
プロテクト メソッド GetNeutralResourcesLanguage 指定した Assembly で NeutralResourcesLanguageAttribute の値を読み取って、メイン アセンブリのニュートラル リソースの CultureInfo を返します。
プロテクト メソッド GetResourceFileName 指定した CultureInfo のリソース ファイルの名前を生成します。
プロテクト メソッド GetSatelliteContractVersion 指定したアセンブリの SatelliteContractVersionAttribute で指定された Version を返します。
プロテクト メソッド InternalGetResourceSet ResourceSet の検索を実装します。
プロテクト メソッド MemberwiseClone  現在の Object の簡易コピーを作成します。 ( Object から継承されます。)
参照参照

関連項目

ResourceManager クラス
System.Resources 名前空間
CultureInfo
SatelliteContractVersionAttribute

その他の技術情報

エンコーディングとローカリゼーション

ResourceManager メンバ

カルチャ固有のリソースに、実行時に簡単にアクセスできるようにします。

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


パブリック コンストラクタパブリック コンストラクタ
プロテクト コンストラクタプロテクト コンストラクタ
パブリック フィールドパブリック フィールド
プロテクト フィールドプロテクト フィールド
  名前 説明
プロテクト フィールド BaseNameField ResourceManager が、リソースを検索するリソース ファイルのルート名を示します。
プロテクト フィールド MainAssembly リソースを含むメイン Assembly を示します。
プロテクト フィールド ResourceSets カルチャから ResourceSet オブジェクトへの割り当てを返す Hashtable を格納します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ ResourceSetType ResourceManager が ResourceSet オブジェクトを生成するために使用する ResourceSet の Type を取得します。
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CreateFileBasedResourceManager アセンブリ マニフェストではなく、リソースの特定のディレクトリを検索する ResourceManager を返します。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetObject オーバーロードされます。 現在の設定に対して指定されている Object リソースの値を取得します。
パブリック メソッド GetResourceSet 特定のカルチャに使用する ResourceSet を取得します。
パブリック メソッド GetStream オーバーロードされます。 MemoryStream から UnmanagedMemoryStream を返します。
パブリック メソッド GetString オーバーロードされます。 指定したカルチャまたは現在の暗黙の UI カルチャの指定した String リソースを取得します。
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ReleaseAllResources すべての ResourceSet オブジェクトの Close を呼び出し、すべてのリソースを解放するように ResourceManager に指示します。
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Finalize  Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。)
プロテクト メソッド GetNeutralResourcesLanguage 指定した Assembly で NeutralResourcesLanguageAttribute の値を読み取って、メイン アセンブリのニュートラル リソースの CultureInfo を返します。
プロテクト メソッド GetResourceFileName 指定した CultureInfo のリソース ファイルの名前を生成します。
プロテクト メソッド GetSatelliteContractVersion 指定したアセンブリの SatelliteContractVersionAttribute で指定された Version を返します。
プロテクト メソッド InternalGetResourceSet ResourceSet の検索を実装します。
プロテクト メソッド MemberwiseClone  現在の Object の簡易コピーを作成します。 (Object から継承されます。)
参照参照

関連項目

ResourceManager クラス
System.Resources 名前空間
CultureInfo
SatelliteContractVersionAttribute

その他の技術情報

エンコーディングとローカリゼーション



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「ResourceManager」の関連用語











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

   

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



ResourceManagerのページの著作権

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

©2026 GRAS Group, Inc.RSS