ResourceManager コンストラクタ ()
アセンブリ: mscorlib (mscorlib.dll 内)



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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ResourceManager コンストラクタ (Type)
アセンブリ: mscorlib (mscorlib.dll 内)



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

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ResourceManager コンストラクタ (String, Assembly, Type)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim baseName As String Dim assembly As Assembly Dim usingResourceSet As Type Dim instance As New ResourceManager(baseName, assembly, usingResourceSet)


それぞれのリソース ファイルは、サテライト アセンブリに含める必要があります。インバリアント カルチャの .resources ファイルはメイン アセンブリに含めます。サテライト アセンブリは、そのアセンブリのマニフェストで指定されている単一カルチャのリソースを含んでいるものと見なされ、必要に応じて読み込まれます。
使用する ResourceSet 実装を指定できます。特定の ResourceSet を実装する必要がなくても、カスタム リソース ファイル形式を使用する場合は、ResourceSet クラスから派生させ、GetDefaultReader と GetDefaultWriter をオーバーライドし、その型をこのコンストラクタに渡します。
![]() |
---|
usingResourceSet パラメータを使用して、独自のリソース形式をサポートします。通常は null 参照 (Visual Basic では Nothing) です。これは、Type だけをとるコンストラクタとは異なります。 |

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ResourceManager コンストラクタ

名前 | 説明 |
---|---|
ResourceManager () | ResourceManager クラスの新しいインスタンスを既定値で初期化します。 .NET Compact Framework によってサポートされています。 |
ResourceManager (Type) | 指定した Type の情報に基づいて、サテライト アセンブリでリソースを検索する ResourceManager を作成します。 .NET Compact Framework によってサポートされています。 |
ResourceManager (String, Assembly) | 指定したルート名から派生したファイルに含まれているリソースを検索する ResourceManager クラスの新しいインスタンスを、指定した Assembly を使用して初期化します。 .NET Compact Framework によってサポートされています。 |
ResourceManager (String, Assembly, Type) | 指定したルート名から派生したファイルに含まれているリソースを検索する ResourceManager クラスの新しいインスタンスを、指定した Assembly を使用して初期化します。 .NET Compact Framework によってサポートされています。 |

ResourceManager コンストラクタ (String, Assembly)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim baseName As String Dim assembly As Assembly Dim instance As New ResourceManager(baseName, assembly)


それぞれのリソース ファイルは、サテライト アセンブリに含める必要があります。インバリアント カルチャの .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

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ResourceManager コンストラクタ ()のページへのリンク