ResourceWriter.Generate メソッド
アセンブリ: mscorlib (mscorlib.dll 内)



Generate は、すべての AddResource 呼び出しを実行した後で、1 回だけ呼び出すことができます。リソースを書き込むときに例外が発生した場合、書き込まれる情報が無効であることから、出力ストリームは閉じられます。
通常、Generate は出力ストリームを閉じません。独自のデータを .resources ファイルに組み合わせる場合、または後でストリームにアクセスする必要がある場合を除いて、Generate を呼び出した後で Close を呼び出すか、単に Close を呼び出す必要があります。

Imports System Imports System.Resources Imports System.IO Public Class WriteResources Public Shared Sub Main(ByVal args() As String) ' Create a file stream to encapsulate items.resources. Dim fs As New FileStream("items.resources", _ FileMode.OpenOrCreate, FileAccess.Write) ' Open a resource writer to write from the stream. Dim writer = New ResourceWriter(fs) ' Add resources to the resource writer. writer.AddResource("String 1", "First String") writer.AddResource("String 2", "Second String") writer.AddResource("String 3", "Third String") ' Generate the resources, and close the writer. writer.Generate() writer.Close() End Sub End Class
using System; using System.Resources; using System.IO; public class WriteResources { public static void Main(string[] args) { // Create a file stream to encapsulate items.resources. FileStream fs = new FileStream("items.resources", FileMode.OpenOrCreate,FileAccess.Write); // Open a resource writer to write from the stream. IResourceWriter writer = new ResourceWriter(fs); // Add resources to the resource writer. writer.AddResource("String 1", "First String"); writer.AddResource("String 2", "Second String"); writer.AddResource("String 3", "Third String"); // Generate the resources, and close the writer. writer.Generate(); writer.Close(); } }
using namespace System; using namespace System::Resources; using namespace System::IO; int main() { // Create a file stream to encapsulate items.resources. FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); // Open a resource writer to write from the stream. IResourceWriter^ writer = gcnew ResourceWriter( fs ); // Add resources to the resource writer. writer->AddResource( "String 1", "First String" ); writer->AddResource( "String 2", "Second String" ); writer->AddResource( "String 3", "Third String" ); // Generate the resources, and close the writer. writer->Generate(); writer->Close(); }
import System.*; import System.Resources.*; import System.IO.*; public class WriteResources { public static void main(String[] args) { // Create a file stream to encapsulate items.resources. FileStream fs = new FileStream("items.resources", FileMode.OpenOrCreate, FileAccess.Write); // Open a resource writer to write from the stream. IResourceWriter writer = new ResourceWriter(fs); // Add resources to the resource writer. writer.AddResource("String 1", "First String"); writer.AddResource("String 2", "Second String"); writer.AddResource("String 3", "Third String"); // Generate the resources, and close the writer. writer.Generate(); writer.Close(); } //main } //WriteResources

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からResourceWriter.Generate メソッドを検索する場合は、下記のリンクをクリックしてください。

- ResourceWriter.Generate メソッドのページへのリンク