次の方法で共有


ResourceWriter コンストラクタ (String)

指定したファイルにリソースを書き込む ResourceWriter クラスの新しいインスタンスを初期化します。

名前空間: System.Resources
アセンブリ: mscorlib (mscorlib.dll 内)

構文

'宣言
Public Sub New ( _
    fileName As String _
)
'使用
Dim fileName As String

Dim instance As New ResourceWriter(fileName)
public ResourceWriter (
    string fileName
)
public:
ResourceWriter (
    String^ fileName
)
public ResourceWriter (
    String fileName
)
public function ResourceWriter (
    fileName : String
)

パラメータ

  • fileName
    出力ファイル名。

例外

例外の種類 条件

ArgumentNullException

fileName パラメータが null 参照 (Visual Basic では Nothing) です。

使用例

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

プラットフォーム

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

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

ResourceWriter クラス
ResourceWriter メンバ
System.Resources 名前空間

その他の技術情報

エンコーディングとローカリゼーション