ResourceSet ResourceSet ResourceSet ResourceSet Class

定義

儲存針對某個文化特性並忽略其他所有文化特性進行當地語系化的所有資源,包括任何後援規則。Stores all the resources localized for one particular culture, ignoring all other cultures, including any fallback rules.

public ref class ResourceSet : IDisposable, System::Collections::IEnumerable
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class ResourceSet : IDisposable, System.Collections.IEnumerable
type ResourceSet = class
    interface IDisposable
    interface IEnumerable
Public Class ResourceSet
Implements IDisposable, IEnumerable
繼承
ResourceSetResourceSetResourceSetResourceSet
衍生
屬性
實作

備註

重要

使用不信任的資料呼叫此類別的方法,會造成安全性上的風險。Calling methods from this class with untrusted data is a security risk. 呼叫此類別的方法時,請一律使用信任的資料。Call the methods from this class only with trusted data. 如需詳細資訊,請參閱資料驗證For more information, see Data Validation.

ResourceSet類別列舉IResourceReader、 載入每個名稱和值,並將它們儲存在HashtableThe ResourceSet class enumerates over an IResourceReader, loading every name and value, and storing them in a Hashtable. 自訂IResourceReader可用。A custom IResourceReader can be used.

您可以具現化ResourceSet物件,代表特定文化特性的資源,藉由呼叫ResourceManager.GetResourceSet方法。You can instantiate a ResourceSet object that represents the resources of a specific culture by calling the ResourceManager.GetResourceSet method.

重要

此類型會實作IDisposable介面。This type implements the IDisposable interface. 當您完成使用型別時,您應該處置它直接或間接。When you have finished using the type, you should dispose of it either directly or indirectly. 若要直接處置型別,呼叫其Dispose方法中的try / catch區塊。To dispose of the type directly, call its Dispose method in a try/catch block. 若要處置它間接,使用的語言建構這類using(在 C# 中) 或Using(在 Visual Basic)。To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). 如需詳細資訊,請參閱 「 使用物件,實作 IDisposable 」 一節IDisposable介面 > 主題。For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

給繼承者的注意事項

衍生的類別ResourceSet,使用自己的資源讀取器和寫入器應該覆寫GetDefaultReader(),和GetDefaultWriter(),以提供適當的功能,用於解譯的資源集。Derived classes of ResourceSet that use their own resource reader and writer should override GetDefaultReader(), and GetDefaultWriter(), to provide the appropriate functionality for interpreting the resource set.

建構函式

ResourceSet() ResourceSet() ResourceSet() ResourceSet()

使用預設屬性,初始化 ResourceSet 類別的新執行個體。Initializes a new instance of the ResourceSet class with default properties.

ResourceSet(IResourceReader) ResourceSet(IResourceReader) ResourceSet(IResourceReader) ResourceSet(IResourceReader)

使用指定的資源讀取器來建立 ResourceSet 類別的新執行個體。Creates a new instance of the ResourceSet class using the specified resource reader.

ResourceSet(Stream) ResourceSet(Stream) ResourceSet(Stream) ResourceSet(Stream)

使用從指定資料流讀取資源的系統預設 ResourceSet,來建立 ResourceReader 類別的新執行個體。Creates a new instance of the ResourceSet class using the system default ResourceReader that reads resources from the given stream.

ResourceSet(String) ResourceSet(String) ResourceSet(String) ResourceSet(String)

使用從指定檔案開啟和讀取資源的系統預設 ResourceSet,來建立 ResourceReader 類別的新執行個體。Creates a new instance of the ResourceSet class using the system default ResourceReader that opens and reads resources from the given file.

欄位

Reader Reader Reader Reader

表示用來讀取資源的 IResourceReaderIndicates the IResourceReader used to read the resources.

Table Table Table Table

用來儲存資源的 HashtableThe Hashtable in which the resources are stored.

方法

Close() Close() Close() Close()

關閉並釋放這個 ResourceSet 所使用的任何資源。Closes and releases any resources used by this ResourceSet.

Dispose() Dispose() Dispose() Dispose()

處置 ResourceSet 之目前執行個體所使用的資源 (除了記憶體之外)。Disposes of the resources (other than memory) used by the current instance of ResourceSet.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放與目前執行個體關聯的資源 (除了記憶體以外),如果要求的話,請關閉內部 Managed 物件。Releases resources (other than memory) associated with the current instance, closing internal managed objects if requested.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetDefaultReader() GetDefaultReader() GetDefaultReader() GetDefaultReader()

傳回這種 ResourceSet 較佳的資源讀取器類別。Returns the preferred resource reader class for this kind of ResourceSet.

GetDefaultWriter() GetDefaultWriter() GetDefaultWriter() GetDefaultWriter()

傳回這種 ResourceSet 較佳的資源寫入器類別。Returns the preferred resource writer class for this kind of ResourceSet.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

傳回可以逐一查看 IDictionaryEnumeratorResourceSetReturns an IDictionaryEnumerator that can iterate through the ResourceSet.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetObject(String) GetObject(String) GetObject(String) GetObject(String)

以指定的名稱搜尋資源物件。Searches for a resource object with the specified name.

GetObject(String, Boolean) GetObject(String, Boolean) GetObject(String, Boolean) GetObject(String, Boolean)

如果要求的話,以不區分大小寫的指定名稱搜尋資源物件。Searches for a resource object with the specified name in a case-insensitive manner, if requested.

GetString(String) GetString(String) GetString(String) GetString(String)

以指定的名稱搜尋 String 資源。Searches for a String resource with the specified name.

GetString(String, Boolean) GetString(String, Boolean) GetString(String, Boolean) GetString(String, Boolean)

如果要求的話,以不區分大小寫的指定名稱搜尋 String 資源。Searches for a String resource with the specified name in a case-insensitive manner, if requested.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ReadResources() ReadResources() ReadResources() ReadResources()

讀取所有資源,並將它們儲存在 Hashtable 屬性指示的 Table 中。Reads all the resources and stores them in a Hashtable indicated in the Table property.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

明確介面實作

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

傳回 IEnumerator 物件,以避免與 Dispose 發生競爭情況。Returns an IEnumerator object to avoid a race condition with Dispose. 這個成員並不適合直接從程式碼使用。This member is not intended to be used directly from your code.

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

適用於