ResourceWriter 생성자

정의

ResourceWriter 클래스의 새 인스턴스를 초기화합니다.

오버로드

ResourceWriter(Stream)

제공된 스트림에 리소스를 쓰는 ResourceWriter 클래스의 새 인스턴스를 초기화합니다.

ResourceWriter(String)

지정된 파일에 리소스를 쓰는 ResourceWriter 클래스의 새 인스턴스를 초기화합니다.

ResourceWriter(Stream)

제공된 스트림에 리소스를 쓰는 ResourceWriter 클래스의 새 인스턴스를 초기화합니다.

public:
 ResourceWriter(System::IO::Stream ^ stream);
public ResourceWriter (System.IO.Stream stream);
new System.Resources.ResourceWriter : System.IO.Stream -> System.Resources.ResourceWriter
Public Sub New (stream As Stream)

매개 변수

stream
Stream

출력 스트림입니다.

예외

stream 매개 변수를 쓸 수 없는 경우

stream 매개 변수가 null인 경우

예제

다음 코드 예제에서는 지정된 스트림에 ResourceWriter 쓰는 클래스의 새 인스턴스를 정의합니다. 코드는 작성기에 리소스를 추가하고 스트림에 리소스를 씁니다.

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" );
   
   // Write the resources to the stream, and close it.
   writer->Close();
}
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");

        // Write the resources to the stream, and close it.
        writer.Close();
    }
}
Imports System.Resources
Imports System.IO

Public Class WriteResources
   
    Public Shared Sub Main(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")
      
        ' Write the resources to the stream, and close it.
        writer.Close()
    End Sub

End Class

추가 정보

적용 대상

ResourceWriter(String)

지정된 파일에 리소스를 쓰는 ResourceWriter 클래스의 새 인스턴스를 초기화합니다.

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

매개 변수

fileName
String

출력 파일 이름입니다.

예외

fileName 매개 변수가 null인 경우

예제

다음 코드 예제에서는 지정된 파일에 쓸 클래스의 ResourceWriter 새 인스턴스를 정의합니다. 코드는 작성기에 리소스를 추가하고 리소스를 파일에 씁니다.

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();
}
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();
   }
}
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

추가 정보

적용 대상