ResourceManager 构造函数

定义

初始化 ResourceManager 类的新实例。Initializes a new instance of the ResourceManager class.

重载

ResourceManager()

使用默认值初始化 ResourceManager 类的新实例。Initializes a new instance of the ResourceManager class with default values.

ResourceManager(Type)

它根据指定的对象中的信息在附属程序集内查找资源来初始化 ResourceManager 类的新实例。Initializes a new instance of the ResourceManager class that looks up resources in satellite assemblies based on information from the specified type object.

ResourceManager(String, Assembly)

初始化 ResourceManager 类的新实例,该实例在给定的程序集中查找从指定根名称导出的文件中包含的资源。Initializes a new instance of the ResourceManager class that looks up resources contained in files with the specified root name in the given assembly.

ResourceManager(String, Assembly, Type)

初始化使用指定 ResourceSetResourceManager 类的新实例,该实例在给定的程序集中的指定根名称类的文件中查找资源。Initializes a new instance of the ResourceManager class that uses a specified ResourceSet class to look up resources contained in files with the specified root name in the given assembly.

ResourceManager()

使用默认值初始化 ResourceManager 类的新实例。Initializes a new instance of the ResourceManager class with default values.

protected:
 ResourceManager();
protected ResourceManager ();
Protected Sub New ()

注解

仅当您编写自己的派生自ResourceManager类的类时,此构造函数才有用。This constructor is useful only if you write your own class that derives from the ResourceManager class.

ResourceManager(Type)

它根据指定的对象中的信息在附属程序集内查找资源来初始化 ResourceManager 类的新实例。Initializes a new instance of the ResourceManager class that looks up resources in satellite assemblies based on information from the specified type object.

public:
 ResourceManager(Type ^ resourceSource);
public ResourceManager (Type resourceSource);
new System.Resources.ResourceManager : Type -> System.Resources.ResourceManager
Public Sub New (resourceSource As Type)

参数

resourceSource
Type

一个类型,从资源管理器中派生所有用于查找 .resources 文件的信息。A type from which the resource manager derives all information for finding .resources files.

异常

resourceSource 参数为 nullThe resourceSource parameter is null.

示例

下面的示例使用ResourceManager(Type)构造函数ResourceManager实例化对象。The following example uses the ResourceManager(Type) constructor to instantiate a ResourceManager object. 它包含从 .txt 文件中编译的、英语(en)、法语(法国)(fr)和俄语(俄罗斯)(ru)区域性的资源。It consists of resources compiled from .txt files for the English (en), French (France) (fr-FR), and Russian (Russia) (ru-RU) cultures. 该示例将当前区域性和当前 UI 区域性更改为英语(美国)、法语(法国)、俄语(俄罗斯)和瑞典语(瑞典)。The example changes the current culture and current UI culture to English (United States), French (France), Russian (Russia), and Swedish (Sweden). 然后,它会GetString(String)调用方法来检索已本地化的字符串,该字符串将显示依赖于当天的时间的问候语。It then calls the GetString(String) method to retrieve the localized string, which displays a greeting that depends on the time of day.

该示例需要三个基于文本的资源文件,如下表所示。The example requires three text-based resource files, as listed in the following table. 每个文件都包含名MorningAfternoon、和Evening的字符串资源。Each file includes string resources named Morning, Afternoon, and Evening.

cultureCulture 文件名File name 资源名称Resource name 资源值Resource value
en-USen-US GreetingResources.txtGreetingResources.txt Morning 早上好Good morning
en-USen-US GreetingResources.txtGreetingResources.txt Afternoon 下午好Good afternoon
en-USen-US GreetingResources.txtGreetingResources.txt Evening 晚上好Good evening
fr-FRfr-FR GreetingResources.fr-FR.txtGreetingResources.fr-FR.txt Morning BonjourBonjour
fr-FRfr-FR GreetingResources.fr-FR.txtGreetingResources.fr-FR.txt Afternoon BonjourBonjour
fr-FRfr-FR GreetingResources.fr-FR.txtGreetingResources.fr-FR.txt Evening BonsoirBonsoir
ru-RUru-RU GreetingResources.ru-RU.txtGreetingResources.ru-RU.txt Morning Доброе утроДоброе утро
ru-RUru-RU GreetingResources.ru-RU.txtGreetingResources.ru-RU.txt Afternoon Добрый деньДобрый день
ru-RUru-RU GreetingResources.ru-RU.txtGreetingResources.ru-RU.txt Evening Добрый вечерДобрый вечер

您可以使用以下批处理文件编译 Visual Basic 示例并创建一个名为 Fibonacci 的可执行文件。You can use the following batch file to compile the Visual Basic example and create an executable named Greet.exe. 若要用C#编译,请将编译器的vbc名称csc从更改为,并.vb.cs文件扩展名从更改为。To compile with C#, change the compiler name from vbc to csc and the file extension from .vb to .cs.

  
resgen GreetingResources.txt  
vbc Greet.vb /resource: GreetingResources.resources  
  
md fr-FR  
resgen GreetingResources.fr-FR.txt  
al /out:fr-FR\Greet.resources.dll /culture:fr-FR /embed: GreetingResources.fr-FR.resources   
  
md ru-RU  
resgen GreetingResources.ru-RU.txt  
al /out:ru-RU\Greet.resources.dll /culture:ru-RU /embed: GreetingResources.ru-RU.resources  
  

下面是示例的源代码(适用于 Visual Basic 版本的 ShowDate 或代码C#版本的 ShowDate.cs)。Here's the source code for the example (ShowDate.vb for the Visual Basic version or ShowDate.cs for the C# version of the code).

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

[assembly:NeutralResourcesLanguage("en")]

public class Example
{
   public static void Main()
   {
      string[] cultureNames = {"en-US", "fr-FR", "ru-RU", "sv-SE" };
      DateTime noon = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 
                                   DateTime.Now.Day, 12,0,0);
      DateTime evening = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
                                      DateTime.Now.Day, 18, 0, 0);                          
      
      ResourceManager rm = new ResourceManager(typeof(GreetingResources));
      
      foreach (var cultureName in cultureNames) {
         Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(cultureName);
         Console.WriteLine("The current UI culture is {0}", 
                           CultureInfo.CurrentUICulture.Name);
         if (DateTime.Now < noon)
            Console.WriteLine("{0}!", rm.GetString("Morning"));
         else if (DateTime.Now < evening)
            Console.WriteLine("{0}!", rm.GetString("Afternoon"));
         else
            Console.WriteLine("{0}!", rm.GetString("Evening"));
         Console.WriteLine();
      }
   }

   internal class GreetingResources
   {
   }
}
// The example displays output like the following:
//       The current UI culture is en-US
//       Good afternoon!
//       
//       The current UI culture is fr-FR
//       Bonjour!
//       
//       The current UI culture is ru-RU
//       Добрый день!
//       
//       The current UI culture is sv-SE
//       Good afternoon!
Imports System.Resources
Imports System.Globalization
Imports System.Threading

<Assembly:NeutralResourcesLanguage("en")>

Module Example
   Public Sub Main()
      Dim cultureNames() As String = {"en-US", "fr-FR", "ru-RU", "sv-SE" }
      Dim noon As New Date(Date.Now.Year, Date.Now.Month, 
                           Date.Now.Day, 12,0,0)
      Dim evening As New Date(Date.Now.Year, Date.Now.Month,
                              Date.Now.Day, 18, 0, 0)                          
      
      Dim rm As New ResourceManager(GetType(GreetingResources))
      
      For Each cultureName In cultureNames
         Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(cultureName)
         Console.WriteLine("The current UI culture is {0}", 
                           CultureInfo.CurrentUICulture.Name)
         If Date.Now < noon Then
            Console.WriteLine("{0}!", rm.GetString("Morning"))
         ElseIf Date.Now < evening Then
            Console.WriteLine("{0}!", rm.GetString("Afternoon"))
         Else
            Console.WriteLine("{0}!", rm.GetString("Evening"))
         End If 
         Console.WriteLine()
      Next
   End Sub
End Module

Friend Class GreetingResources
End Class
' The example displays output like the following:
'       The current UI culture is en-US
'       Good afternoon!
'       
'       The current UI culture is fr-FR
'       Bonjour!
'       
'       The current UI culture is ru-RU
'       Добрый день!
'       
'       The current UI culture is sv-SE
'       Good afternoon!

除了定义名为Example的应用类之外,源代码还定义了一个内部类,其GreetingResources名称与资源文件的基名称相同。In addition to defining an app class named Example, the source code defines an internal class whose name, GreetingResources, is the same as the base name of the resource files. 这样就可以通过ResourceManager ResourceManager(Type)调用构造函数来成功地实例化对象。This makes it possible to successfully instantiate a ResourceManager object by calling the ResourceManager(Type) constructor.

请注意,输出会显示相应的本地化字符串,除非当前 UI 区域性为瑞典语(瑞典),在这种情况下,它使用英语资源。Notice that the output displays the appropriate localized string except when the current UI culture is Swedish (Sweden), in which case it uses English language resources. 由于瑞典语的资源不可用,因此应用程序将使用由NeutralResourcesLanguageAttribute特性定义的默认区域性的资源。Because Swedish language resources are unavailable, the app uses the resources of the default culture, as defined by the NeutralResourcesLanguageAttribute attribute, instead.

注解

桌面应用Desktop Apps

在桌面应用中,资源管理器使用resourceSource参数加载特定的资源文件,如下所示:In desktop apps, the resource manager uses the resourceSource parameter to load a particular resource file as follows:

  • 如果未使用特性指示默认区域性的资源位于附属程序集中,则资源管理器将假定在与指定的类型相同的程序集中找到默认区域性的资源文件。 NeutralResourcesLanguageAttribute resourceSource参数。If the NeutralResourcesLanguageAttribute attribute is not used to indicate that the resources of the default culture reside in a satellite assembly, the resource manager assumes that the resource file for the default culture is found in the same assembly as the type specified by the resourceSource parameter.

  • 资源管理器假定默认资源文件的基名称与resourceSource参数指定的类型相同。The resource manager assumes that the default resource file has the same base name as the type specified by the resourceSource parameter.

  • 资源管理器使用默认ResourceSet类处理资源文件。The resource manager uses the default ResourceSet class to manipulate the resource file.

例如,假设有一个名为 MyCompany. MyProduct 的类型,则资源管理器会在定义 MyProduct 的程序集内查找名为 MyCompany. MyType. MyType..。For example, given a type named MyCompany.MyProduct.MyType, the resource manager looks for a .resources file named MyCompany.MyProduct.MyType.resources in the assembly that defines MyType.

在 Visual Studio 中,资源设计器会自动生成代码, internal该代码C#定义了Friend (在中)或(在 Visual Basic)类,其名称与默认区域性的 .resources 文件的基名称相同。In Visual Studio, the Resource Designer automatically generates code that defines an internal (in C#) or Friend (in Visual Basic) class whose name is the same as the base name of the .resources file for the default culture. 这样一来,就可以通过ResourceManager获取名称与资源名称对应的类型对象来实例化对象并将其与特定的一组资源相结合,因为只要类对编译器可见,资源就必须为这样.This makes it possible to instantiate a ResourceManager object and couple it with a particular set of resources by getting a type object whose name corresponds to the name of the resource, because as long as the class is visible to the compiler, the resources must be as well. 例如,如果 .resources 文件命名为 resource1.resx,则以下语句将实例化一个ResourceManager对象来管理名为 resource1.resx 的 .resources 文件:For example, if a .resources file is named Resource1, the following statement instantiates a ResourceManager object to manage the .resources file named Resource1:

ResourceManager rm = new ResourceManager(typeof(Resource1));

如果未使用 Visual Studio,则可以创建一个类,其中没有命名空间和名称与默认 .resources 文件相同的成员。If you're not using Visual Studio, you can create a class with no members whose namespace and name are the same as that of the default .resources file. 说明如示例所示。The example provides an illustration.

Windows 8.x 应用商店Windows 8.x Store 应用程序Apps

重要

尽管此ResourceManager类在应用中Windows 8.x 应用商店Windows 8.x Store受支持,但我们不建议使用它。Although the ResourceManager class is supported in Windows 8.x 应用商店Windows 8.x Store apps, we do not recommend its use. 仅当你开发可移植类库Portable Class LibraryWindows 8.x 应用商店Windows 8.x Store用于应用程序的项目时,才使用此类。Use this class only when you develop 可移植类库Portable Class Library projects that can be used with Windows 8.x 应用商店Windows 8.x Store apps. 若要从Windows 8.x 应用商店Windows 8.x Store应用中检索资源,请改用windows.applicationmodel.resources.core. windows.applicationmodel.resources.resourceloader类。To retrieve resources from Windows 8.x 应用商店Windows 8.x Store apps, use the Windows.ApplicationModel.Resources.ResourceLoader class instead.

Windows 8.x 应用商店Windows 8.x Store应用程序ResourceManager中, resourceSource使用参数来推断程序集、基名称和命名空间,其中的资源项可位于应用的包资源索引(PRI)文件中。In Windows 8.x 应用商店Windows 8.x Store apps, ResourceManager uses the resourceSource parameter to infer the assembly, base name, and the namespace where the resource items can be located within the app's package resource index (PRI) file. 例如,如果在中MyAssembly定义了一个名为 MyCompany. MyProduct. MyType 的类型,则资源管理器将查找名为 MyAssembly 的资源集标识符,并在该资源集内查找作用域 MyCompany. MyProduct。For example, given a type named MyCompany.MyProduct.MyType that is defined in MyAssembly, the resource manager looks for a resource set identifier named MyAssembly and looks for a scope MyCompany.MyProduct.MyType within that resource set. 资源管理器在此范围内搜索默认上下文(当前区域性、当前高对比度设置等)下的资源项。The resource manager searches for resource items under the default context (current culture, current high contrast setting, and so on) within this scope.

ResourceManager(String, Assembly)

初始化 ResourceManager 类的新实例,该实例在给定的程序集中查找从指定根名称导出的文件中包含的资源。Initializes a new instance of the ResourceManager class that looks up resources contained in files with the specified root name in the given assembly.

public:
 ResourceManager(System::String ^ baseName, System::Reflection::Assembly ^ assembly);
public ResourceManager (string baseName, System.Reflection.Assembly assembly);
new System.Resources.ResourceManager : string * System.Reflection.Assembly -> System.Resources.ResourceManager

参数

baseName
String

资源文件的根名称,没有其扩展名但是包含所有完全限定的命名空间名称。The root name of the resource file without its extension but including any fully qualified namespace name. 例如,名为 MyApplication.MyResource.en-US.resources 的资源文件的根名称为 MyApplication.MyResource。For example, the root name for the resource file named MyApplication.MyResource.en-US.resources is MyApplication.MyResource.

assembly
Assembly

资源的主程序集。The main assembly for the resources.

异常

baseNameassembly 参数为 nullThe baseName or assembly parameter is null.

示例

下面的示例使用简单的非本地化 "Hello World" 应用程序来说明ResourceManager(String, Assembly)构造函数。The following example uses a simple non-localized "Hello World" app to illustrate the ResourceManager(String, Assembly) constructor. 下面显示了一个名为 ExampleResources 的文本文件的内容。The following shows the contents of a text file named ExampleResources.txt. 在编译应用程序时,会将资源嵌入主应用程序集中。When the app is compiled, the resource is embedded in the main app assembly.

Greeting=Hello  

在命令提示符下,可以使用资源文件生成器(resgen.exe)将文本文件转换为二进制资源文件,如下所示:The text file can be converted to a binary resource file by using the Resource File Generator (ResGen.exe) at the command prompt as follows:

resgen ExampleResources.txt  

下面的示例提供了实例化ResourceManager对象的可执行代码,并提示用户输入名称并显示问候语。The following example provides the executable code that instantiates a ResourceManager object, prompts the user to enter a name, and displays a greeting.

using System;
using System.Reflection;
using System.Resources;

public class Example
{
   public static void Main()
   {
      // Retrieve the resource.
      ResourceManager rm = new ResourceManager("ExampleResources" , 
                               typeof(Example).Assembly);
      string greeting = rm.GetString("Greeting");
      
      Console.Write("Enter your name: ");
      string name = Console.ReadLine();
      Console.WriteLine("{0} {1}!", greeting, name);
   }
}
// The example produces output similar to the following:
//       Enter your name: John
//       Hello John!
Imports System.Globalization
Imports System.Reflection
Imports System.Resources

Module Example
   Public Sub Main()
      ' Retrieve the resource.
      Dim rm As New ResourceManager("ExampleResources", 
                                    GetType(Example).Assembly)
      Dim greeting As String = rm.GetString("Greeting")
      
      Console.Write("Enter your name: ")
      Dim name As String = Console.ReadLine()
      Console.WriteLine("{0} {1}!", greeting, name)
   End Sub
End Module
' The example produces output similar to the following:
'       Enter your name: John
'       Hello John!

可以在 Visual Basic 中使用以下命令编译该方法:It can be compiled by using the following command in Visual Basic:

vbc Example.vb /resource:ExampleResources.resources  

或使用中C#的以下命令:or by using the following command in C#:

csc Example.cs /resource:ExampleResources.resources  

请注意,该示例通过将该程序集中定义的类型传递给typeof函数(在中C#)或GetType函数(在 Visual Basic 中)并检索其Type.Assembly属性。Note that the example retrieves a reference to the assembly that contains the resource file by passing a type defined in that assembly to the typeof function (in C#) or the GetType function (in Visual Basic) and retrieving the value of its Type.Assembly property.

注解

桌面应用Desktop Apps

在桌面应用中,每个特定于区域性的资源文件应包含在附属程序集中,并且默认区域性的资源文件应包含在主程序集中。In desktop apps, the individual culture-specific resource files should be contained in satellite assemblies, and the default culture's resource file should be contained in the main assembly. 假设附属程序集包含该程序集清单中指定的单个区域性的资源,并在必要时进行加载。A satellite assembly is assumed to contain resources for a single culture specified in that assembly's manifest, and is loaded as necessary.

备注

若要直接从 .resources 文件检索资源而不是从程序集检索资源,则必须CreateFileBasedResourceManager改为调用方法来ResourceManager实例化对象。To retrieve resources from .resources files directly instead of retrieving them from assemblies, you must call the CreateFileBasedResourceManager method instead to instantiate a ResourceManager object.

如果在中assembly找不到baseName标识的资源文件ResourceManager ,则该方法将实例化对象,但检索特定资源的尝试通常MissingManifestResourceException会引发异常。If the resource file identified by baseName cannot be found in assembly, the method instantiates a ResourceManager object, but the attempt to retrieve a specific resource throws an exception, typically MissingManifestResourceException. 有关诊断引发异常的原因的信息,请参阅ResourceManager类主题中的 "处理 MissingManifestResourceException 异常" 一节。For information about diagnosing the cause of the exception, see the "Handling the MissingManifestResourceException Exception" section of the ResourceManager class topic.

Windows 8.x 应用商店Windows 8.x Store 应用程序Apps

重要

尽管此ResourceManager类在应用中Windows 8.x 应用商店Windows 8.x Store受支持,但我们不建议使用它。Although the ResourceManager class is supported in Windows 8.x 应用商店Windows 8.x Store apps, we do not recommend its use. 仅当你开发可移植类库Portable Class LibraryWindows 8.x 应用商店Windows 8.x Store用于应用程序的项目时,才使用此类。Use this class only when you develop 可移植类库Portable Class Library projects that can be used with Windows 8.x 应用商店Windows 8.x Store apps. 若要从Windows 8.x 应用商店Windows 8.x Store应用中检索资源,请改用windows.applicationmodel.resources.core. windows.applicationmodel.resources.resourceloader类。To retrieve resources from Windows 8.x 应用商店Windows 8.x Store apps, use the Windows.ApplicationModel.Resources.ResourceLoader class instead.

Windows 8.x 应用商店Windows 8.x Store应用程序中,资源管理器使用assembly参数的简单名称在应用的包资源索引(PRI)文件中查找匹配的资源集。In Windows 8.x 应用商店Windows 8.x Store apps, the resource manager uses the simple name of the assembly parameter to look up a matching resource set in the app's package resource index (PRI) file. baseName参数用于查找资源集内的资源项。The baseName parameter is used to look up a resource item within the resource set. 例如,PortableLibrary1.Resource1.de 的根名称为 PortableLibrary1. Resource1.resx。For example, the root name for PortableLibrary1.Resource1.de-DE.resources is PortableLibrary1.Resource1.

继承者说明

此构造函数使用系统提供ResourceSet的实现。This constructor uses the system-provided ResourceSet implementation. 若要使用自定义资源文件ResourceSet格式,应从类派生, GetDefaultReader()重写和GetDefaultWriter() ResourceManager(String, Assembly, Type)方法,然后将该类型传递给构造函数。To use a custom resource file format, you should derive from the ResourceSet class, override the GetDefaultReader() and GetDefaultWriter() methods, and pass that type to the ResourceManager(String, Assembly, Type) constructor. 使用自定义ResourceSet对于控制资源缓存策略或支持您自己的资源文件格式非常有用,但通常不是必需的。Using a custom ResourceSet can be useful for controlling resource caching policy or supporting your own resource file format, but is generally not necessary.

ResourceManager(String, Assembly, Type)

初始化使用指定 ResourceSetResourceManager 类的新实例,该实例在给定的程序集中的指定根名称类的文件中查找资源。Initializes a new instance of the ResourceManager class that uses a specified ResourceSet class to look up resources contained in files with the specified root name in the given assembly.

public:
 ResourceManager(System::String ^ baseName, System::Reflection::Assembly ^ assembly, Type ^ usingResourceSet);
public ResourceManager (string baseName, System.Reflection.Assembly assembly, Type usingResourceSet);
new System.Resources.ResourceManager : string * System.Reflection.Assembly * Type -> System.Resources.ResourceManager

参数

baseName
String

资源文件的根名称,没有其扩展名但是包含所有完全限定的命名空间名称。The root name of the resource file without its extension but including any fully qualified namespace name. 例如,名为 MyApplication.MyResource.en-US.resources 的资源文件的根名称为 MyApplication.MyResource。For example, the root name for the resource file named MyApplication.MyResource.en-US.resources is MyApplication.MyResource.

assembly
Assembly

资源的主程序集。The main assembly for the resources.

usingResourceSet
Type

要使用的自定义 ResourceSet 的类型。The type of the custom ResourceSet to use. 如果为 null,则使用默认的运行时 ResourceSet 对象。If null, the default runtime ResourceSet object is used.

异常

usingResourceset 不是 ResourceSet 的派生类。usingResourceset is not a derived class of ResourceSet.

baseNameassembly 参数为 nullThe baseName or assembly parameter is null.

注解

单个区域性特定的资源文件应包含在附属程序集中,并且默认区域性的资源文件应包含在主程序集中。The individual culture-specific resource files should be contained in satellite assemblies, and the default culture's resource file should be contained in the main assembly. 假设附属程序集包含该程序集清单中指定的单个区域性的资源,并在必要时进行加载。A satellite assembly is assumed to contain resources for a single culture specified in that assembly's manifest, and is loaded as necessary.

备注

若要直接从 .resources 文件检索资源而不是从程序集检索资源,则必须CreateFileBasedResourceManager改为调用方法来ResourceManager实例化对象。To retrieve resources from .resources files directly instead of retrieving them from assemblies, you must call the CreateFileBasedResourceManager method instead to instantiate a ResourceManager object.

如果在中assembly找不到baseName标识的资源文件ResourceManager ,则该方法将实例化对象,但检索特定资源的尝试通常MissingManifestResourceException会引发异常。If the resource file identified by baseName cannot be found in assembly, the method instantiates a ResourceManager object, but the attempt to retrieve a specific resource throws an exception, typically MissingManifestResourceException. 有关诊断引发异常的原因的信息,请参阅ResourceManager类主题中的 "处理 MissingManifestResourceException 异常" 一节。For information about diagnosing the cause of the exception, see the "Handling the MissingManifestResourceException Exception" section of the ResourceManager class topic.

备注

参数用于支持您自己的资源格式,通常为nullusingResourceSetThe usingResourceSet parameter is used to support your own resource format, and will commonly be null. 这不同于只采用的Type构造函数。This is different from the constructor that takes a Type only.

调用方说明

此构造函数允许指定ResourceSet实现。This constructor lets you specify a ResourceSet implementation. 如果你ResourceSet不想使用特定的实现,但想要使用自定义资源文件格式,则应该ResourceSet从类派生,重写GetDefaultReader()GetDefaultWriter()方法,然后将该类型传递给此构造函数。If you do not want a specific ResourceSet implementation but would like to use a custom resource file format, you should derive from the ResourceSet class, override the GetDefaultReader() and GetDefaultWriter() methods, and pass that type to this constructor.

适用于