ResourceManager コンストラクタ ()とは? わかりやすく解説

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

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 の Typenull 参照 (Visual Basic では Nothing) の場合は、既定ランタイム ResourceSet使用されます。

例外例外
例外種類条件

ArgumentException

usingResourcesetResourceSet派生クラスではありません。

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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「ResourceManager コンストラクタ ()」の関連用語

ResourceManager コンストラクタ ()のお隣キーワード
検索ランキング

   

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



ResourceManager コンストラクタ ()のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS