ResourceWriter クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<ComVisibleAttribute(True)> _ Public NotInheritable Class ResourceWriter Implements IResourceWriter, IDisposable

ResourceWriter は、IResourceWriter インターフェイスの既定の実装を提供します。
リソースは、AddResource メソッドを使用して、名前と値のペアとして指定されます。検索に使用するときは、リソース名の大文字と小文字は区別されます。しかし、より簡単に編集ツールをサポートし、バグを減らすために、ResourceWriter では .resources ファイルに大文字と小文字の違いだけで区別される名前を含めることはできません。
リソース ファイルを作成するには、一意なファイル名を持つ ResourceWriter を作成し、AddResource を少なくとも 1 回呼び出し、Generate を呼び出してリソースをディスク上のファイルに書き込み、Close を呼び出してファイルを閉じます。Close を呼び出すと、Generate を明示的に呼び出さなければ、Generate が暗黙的に呼び出されます。

myResources.resources ファイルにいくつかの文字列を書き込む例を次に示します。
Imports System Imports System.Resources Public Class WriteResources Public Shared Sub Main() ' Creates a resource writer. Dim writer As New ResourceWriter("myResources.resources") ' Adds resources to the resource writer. writer.AddResource("String 1", "First String") writer.AddResource("String 2", "Second String") writer.AddResource("String 3", "Third String") ' Writes the resources to the file or stream, and closes it. writer.Close() End Sub End Class
using System; using System.Resources; public class WriteResources { public static void Main(string[] args) { // Creates a resource writer. IResourceWriter writer = new ResourceWriter("myResources.resources"); // Adds resources to the resource writer. writer.AddResource("String 1", "First String"); writer.AddResource("String 2", "Second String"); writer.AddResource("String 3", "Third String"); // Writes the resources to the file or stream, and closes it. writer.Close(); } }
using namespace System; using namespace System::Resources; int main() { // Creates a resource writer. IResourceWriter^ writer = gcnew ResourceWriter( "myResources.resources" ); // Adds resources to the resource writer. writer->AddResource( "String 1", "First String" ); writer->AddResource( "String 2", "Second String" ); writer->AddResource( "String 3", "Third String" ); // Writes the resources to the file or stream, and closes it. writer->Close(); }
import System.*; import System.Resources.*; public class WriteResources { public static void main(String[] args) { // Creates a resource writer. IResourceWriter writer = new ResourceWriter("myResources.resources"); // Adds resources to the resource writer. writer.AddResource("String 1", "First String"); writer.AddResource("String 2", "Second String"); writer.AddResource("String 3", "Third String"); // Writes the resources to the file or stream, and closes it. writer.Close(); } //main } //WriteResources

System.Resources.ResourceWriter


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ResourceWriter メンバ
System.Resources 名前空間
IResourceWriter インターフェイス
IDisposable
その他の技術情報
エンコーディングとローカリゼーション
Weblioに収録されているすべての辞書からResourceWriter クラスを検索する場合は、下記のリンクをクリックしてください。

- ResourceWriter クラスのページへのリンク