ResXResourceReader 建構函式

定義

初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class.

多載

ResXResourceReader(Stream)

為指定的資料流,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class for the specified stream.

ResXResourceReader(TextReader)

為指定的 TextReader 初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class for the specified TextReader.

ResXResourceReader(String)

為指定的資源檔,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class for the specified resource file.

ResXResourceReader(Stream, ITypeResolutionService)

使用輸入資料流和型別解析服務,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using an input stream and a type resolution service.

ResXResourceReader(Stream, AssemblyName[])

使用資料流和組件 (Assembly) 名稱陣列,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a stream and an array of assembly names.

ResXResourceReader(TextReader, ITypeResolutionService)

使用文字資料流讀取器和型別解析服務,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a text stream reader and a type resolution service.

ResXResourceReader(TextReader, AssemblyName[])

使用 ResXResourceReader 物件和組件名稱陣列,初始化 TextReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a TextReader object and an array of assembly names.

ResXResourceReader(String, ITypeResolutionService)

使用檔名和型別解析服務,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a file name and a type resolution service.

ResXResourceReader(String, AssemblyName[])

使用 XML 資源檔名稱和組件名稱陣列,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using an XML resource file name and an array of assembly names.

ResXResourceReader(Stream)

為指定的資料流,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class for the specified stream.

public:
 ResXResourceReader(System::IO::Stream ^ stream);
public ResXResourceReader (System.IO.Stream stream);
new System.Resources.ResXResourceReader : System.IO.Stream -> System.Resources.ResXResourceReader

參數

stream
Stream

包含資源的輸入資料流。An input stream that contains resources.

備註

注意

DisposeClose方法不會關閉您在此函式中指定的資料流程。The Dispose and Close methods do not close the stream you specify in this constructor.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(TextReader)

為指定的 TextReader 初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class for the specified TextReader.

public:
 ResXResourceReader(System::IO::TextReader ^ reader);
public ResXResourceReader (System.IO.TextReader reader);
new System.Resources.ResXResourceReader : System.IO.TextReader -> System.Resources.ResXResourceReader
Public Sub New (reader As TextReader)

參數

reader
TextReader

包含資源的文字輸入資料流。A text input stream that contains resources.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(String)

為指定的資源檔,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class for the specified resource file.

public:
 ResXResourceReader(System::String ^ fileName);
public ResXResourceReader (string fileName);
new System.Resources.ResXResourceReader : string -> System.Resources.ResXResourceReader
Public Sub New (fileName As String)

參數

fileName
String

要讀取的資源檔案路徑。The path of the resource file to read.

範例

下列範例會為指定的檔案建立ResXResourceReader類別的新實例, 逐一查看檔案的資源, 並將內容顯示到主控台。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.

#using <system.windows.forms.dll>
#using <System.dll>

using namespace System;
using namespace System::Resources;
using namespace System::Collections;
void main()
{

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


   // Iterate through the resources and display the contents to the console.
   IEnumerator^ myEnum = rsxr->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      DictionaryEntry^ d = safe_cast<DictionaryEntry^>(myEnum->Current);
      Console::WriteLine( "{0}:\t {1}", d->Key, d->Value );
   }


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

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();
   }
}
Imports System.Resources
Imports System.Collections

Class ReadResXResources
   
   Public Shared Sub Main()
      
      ' Create a ResXResourceReader for the file items.resx.
      Dim rsxr As ResXResourceReader
      rsxr = New ResXResourceReader("items.resx")

      ' Iterate through the resources and display the contents to the console.
      Dim d As DictionaryEntry
      For Each d In  rsxr
         Console.WriteLine(d.Key.ToString() + ":" + ControlChars.Tab + d.Value.ToString())
      Next d
      
      'Close the reader.
      rsxr.Close()

   End Sub

End Class

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(Stream, ITypeResolutionService)

使用輸入資料流和型別解析服務,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using an input stream and a type resolution service.

public:
 ResXResourceReader(System::IO::Stream ^ stream, System::ComponentModel::Design::ITypeResolutionService ^ typeResolver);
public ResXResourceReader (System.IO.Stream stream, System.ComponentModel.Design.ITypeResolutionService typeResolver);
new System.Resources.ResXResourceReader : System.IO.Stream * System.ComponentModel.Design.ITypeResolutionService -> System.Resources.ResXResourceReader

參數

stream
Stream

包含資源的輸入資料流。An input stream that contains resources.

typeResolver
ITypeResolutionService

物件,可解析資源中指定的型別名稱。An object that resolves type names specified in a resource.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(Stream, AssemblyName[])

使用資料流和組件 (Assembly) 名稱陣列,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a stream and an array of assembly names.

public:
 ResXResourceReader(System::IO::Stream ^ stream, cli::array <System::Reflection::AssemblyName ^> ^ assemblyNames);
public ResXResourceReader (System.IO.Stream stream, System.Reflection.AssemblyName[] assemblyNames);
new System.Resources.ResXResourceReader : System.IO.Stream * System.Reflection.AssemblyName[] -> System.Resources.ResXResourceReader

參數

stream
Stream

包含資源的輸入資料流。An input stream that contains resources.

assemblyNames
AssemblyName[]

指定一個或多個組件的 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.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(TextReader, ITypeResolutionService)

使用文字資料流讀取器和型別解析服務,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a text stream reader and a type resolution service.

public:
 ResXResourceReader(System::IO::TextReader ^ reader, System::ComponentModel::Design::ITypeResolutionService ^ typeResolver);
public ResXResourceReader (System.IO.TextReader reader, System.ComponentModel.Design.ITypeResolutionService typeResolver);
new System.Resources.ResXResourceReader : System.IO.TextReader * System.ComponentModel.Design.ITypeResolutionService -> System.Resources.ResXResourceReader
Public Sub New (reader As TextReader, typeResolver As ITypeResolutionService)

參數

reader
TextReader

包含資源的文字資料流讀取器。A text stream reader that contains resources.

typeResolver
ITypeResolutionService

物件,可解析資源中指定的型別名稱。An object that resolves type names specified in a resource.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(TextReader, AssemblyName[])

使用 ResXResourceReader 物件和組件名稱陣列,初始化 TextReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a TextReader object and an array of assembly names.

public:
 ResXResourceReader(System::IO::TextReader ^ reader, cli::array <System::Reflection::AssemblyName ^> ^ assemblyNames);
public ResXResourceReader (System.IO.TextReader reader, System.Reflection.AssemblyName[] assemblyNames);
new System.Resources.ResXResourceReader : System.IO.TextReader * System.Reflection.AssemblyName[] -> System.Resources.ResXResourceReader
Public Sub New (reader As TextReader, assemblyNames As AssemblyName())

參數

reader
TextReader

物件,可用於從文字資料流讀取資源。An object used to read resources from a stream of text.

assemblyNames
AssemblyName[]

指定一個或多個組件的 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.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(String, ITypeResolutionService)

使用檔名和型別解析服務,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using a file name and a type resolution service.

public:
 ResXResourceReader(System::String ^ fileName, System::ComponentModel::Design::ITypeResolutionService ^ typeResolver);
public ResXResourceReader (string fileName, System.ComponentModel.Design.ITypeResolutionService typeResolver);
new System.Resources.ResXResourceReader : string * System.ComponentModel.Design.ITypeResolutionService -> System.Resources.ResXResourceReader
Public Sub New (fileName As String, typeResolver As ITypeResolutionService)

參數

fileName
String

包含資源的 XML 資源檔名稱。The name of an XML resource file that contains resources.

typeResolver
ITypeResolutionService

物件,可解析資源中指定的型別名稱。An object that resolves type names specified in a resource.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

ResXResourceReader(String, AssemblyName[])

使用 XML 資源檔名稱和組件名稱陣列,初始化 ResXResourceReader 類別的新執行個體。Initializes a new instance of the ResXResourceReader class using an XML resource file name and an array of assembly names.

public:
 ResXResourceReader(System::String ^ fileName, cli::array <System::Reflection::AssemblyName ^> ^ assemblyNames);
public ResXResourceReader (string fileName, System.Reflection.AssemblyName[] assemblyNames);
new System.Resources.ResXResourceReader : string * System.Reflection.AssemblyName[] -> System.Resources.ResXResourceReader
Public Sub New (fileName As String, assemblyNames As AssemblyName())

參數

fileName
String

包含資源的 XML 資源檔名稱。The name of an XML resource file that contains resources.

assemblyNames
AssemblyName[]

指定一個或多個組件的 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.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

InheritanceDemand
適用於繼承者的完全信任的。for full trust for inheritors. 部分信任的程式碼無法繼承這個成員。This member cannot be inherited by partially trusted code.

適用於