Прочетете на английски Редактиране

Споделяне чрез


ResXResourceReader Constructors

Definition

Initializes a new instance of the ResXResourceReader class.

Overloads

ResXResourceReader(Stream)

Initializes a new instance of the ResXResourceReader class for the specified stream.

ResXResourceReader(TextReader)

Initializes a new instance of the ResXResourceReader class for the specified TextReader.

ResXResourceReader(String)

Initializes a new instance of the ResXResourceReader class for the specified resource file.

ResXResourceReader(Stream, ITypeResolutionService)

Initializes a new instance of the ResXResourceReader class using an input stream and a type resolution service.

ResXResourceReader(Stream, AssemblyName[])

Initializes a new instance of the ResXResourceReader class using a stream and an array of assembly names.

ResXResourceReader(TextReader, ITypeResolutionService)

Initializes a new instance of the ResXResourceReader class using a text stream reader and a type resolution service.

ResXResourceReader(TextReader, AssemblyName[])

Initializes a new instance of the ResXResourceReader class using a TextReader object and an array of assembly names.

ResXResourceReader(String, ITypeResolutionService)

Initializes a new instance of the ResXResourceReader class using a file name and a type resolution service.

ResXResourceReader(String, AssemblyName[])

Initializes a new instance of the ResXResourceReader class using an XML resource file name and an array of assembly names.

ResXResourceReader(Stream)

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class for the specified stream.

C#
public ResXResourceReader(System.IO.Stream stream);

Parameters

stream
Stream

An input stream that contains resources.

Remarks

Бележка

The Dispose and Close methods do not close the stream you specify in this constructor.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(TextReader)

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class for the specified TextReader.

C#
public ResXResourceReader(System.IO.TextReader reader);

Parameters

reader
TextReader

A text input stream that contains resources.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(String)

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class for the specified resource file.

C#
public ResXResourceReader(string fileName);

Parameters

fileName
String

The path of the resource file to read.

Examples

The following example creates a new instance of the ResXResourceReader class for the specified file, iterates through the resources of the file, and displays the contents to the console.

C#
using System;
using System.Resources;
using System.Collections;

class ReadResXResources
{
   public static void Main()
   {

      // Create a ResXResourceReader for the file items.resx.
      ResXResourceReader rsxr = new ResXResourceReader("items.resx");

      // Iterate through the resources and display the contents to the console.
      foreach (DictionaryEntry d in rsxr)
      {
    Console.WriteLine(d.Key.ToString() + ":\t" + d.Value.ToString());
      }

     //Close the reader.
     rsxr.Close();
   }
}

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(Stream, ITypeResolutionService)

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class using an input stream and a type resolution service.

C#
public ResXResourceReader(System.IO.Stream stream, System.ComponentModel.Design.ITypeResolutionService typeResolver);

Parameters

stream
Stream

An input stream that contains resources.

typeResolver
ITypeResolutionService

An object that resolves type names specified in a resource.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(Stream, AssemblyName[])

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class using a stream and an array of assembly names.

C#
public ResXResourceReader(System.IO.Stream stream, System.Reflection.AssemblyName[] assemblyNames);

Parameters

stream
Stream

An input stream that contains resources.

assemblyNames
AssemblyName[]

An array of AssemblyName objects that specifies one or more assemblies. The assemblies are used to resolve a type name in the resource to an actual type.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(TextReader, ITypeResolutionService)

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class using a text stream reader and a type resolution service.

C#
public ResXResourceReader(System.IO.TextReader reader, System.ComponentModel.Design.ITypeResolutionService typeResolver);

Parameters

reader
TextReader

A text stream reader that contains resources.

typeResolver
ITypeResolutionService

An object that resolves type names specified in a resource.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(TextReader, AssemblyName[])

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class using a TextReader object and an array of assembly names.

C#
public ResXResourceReader(System.IO.TextReader reader, System.Reflection.AssemblyName[] assemblyNames);

Parameters

reader
TextReader

An object used to read resources from a stream of text.

assemblyNames
AssemblyName[]

An array of AssemblyName objects that specifies one or more assemblies. The assemblies are used to resolve a type name in the resource to an actual type.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(String, ITypeResolutionService)

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class using a file name and a type resolution service.

C#
public ResXResourceReader(string fileName, System.ComponentModel.Design.ITypeResolutionService typeResolver);
C#
public ResXResourceReader(string fileName, System.ComponentModel.Design.ITypeResolutionService? typeResolver);

Parameters

fileName
String

The name of an XML resource file that contains resources.

typeResolver
ITypeResolutionService

An object that resolves type names specified in a resource.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ResXResourceReader(String, AssemblyName[])

Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs
Source:
ResXResourceReader.cs

Initializes a new instance of the ResXResourceReader class using an XML resource file name and an array of assembly names.

C#
public ResXResourceReader(string fileName, System.Reflection.AssemblyName[] assemblyNames);

Parameters

fileName
String

The name of an XML resource file that contains resources.

assemblyNames
AssemblyName[]

An array of AssemblyName objects that specifies one or more assemblies. The assemblies are used to resolve a type name in the resource to an actual type.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10