संपादित करें

इसके माध्यम से साझा किया गया


PreserializedResourceWriter.AddResource Method

Definition

Overloads

AddResource(String, Byte[])

Adds a byte array as a named resource to the list of resources to be written to a file.

AddResource(String, Object)

Adds an object as a named resource to the list of resources to be written to a file.

AddResource(String, String)

Adds a string as a named resource to the list of resources to be written to a file.

AddResource(String, Stream, Boolean)

Adds a Stream as a named resource to the list of resources to be written to a file.

AddResource(String, String, String)

Adds a resource of the specified type represented by a string value.

AddResource(String, Byte[])

Source:
ResourceWriter.cs
Source:
ResourceWriter.cs

Adds a byte array as a named resource to the list of resources to be written to a file.

public:
 virtual void AddResource(System::String ^ name, cli::array <System::Byte> ^ value);
public void AddResource (string name, byte[]? value);
public void AddResource (string name, byte[] value);
abstract member AddResource : string * byte[] -> unit
override this.AddResource : string * byte[] -> unit
Public Sub AddResource (name As String, value As Byte())

Parameters

name
String

The resource name.

value
Byte[]

The byte array to add as a resource.

Implements

Exceptions

The name is null.

The resource list is null.

Remarks

The resources are not written until Generate() is called.

Applies to

AddResource(String, Object)

Source:
ResourceWriter.cs
Source:
ResourceWriter.cs

Adds an object as a named resource to the list of resources to be written to a file.

public:
 virtual void AddResource(System::String ^ name, System::Object ^ value);
public void AddResource (string name, object? value);
public void AddResource (string name, object value);
abstract member AddResource : string * obj -> unit
override this.AddResource : string * obj -> unit
Public Sub AddResource (name As String, value As Object)

Parameters

name
String

The resource name.

value
Object

The object to add as a resource.

Implements

Exceptions

The name is null.

The resource list is null.

The stream is unseekable.

Remarks

The resources are not written until Generate() is called.

Applies to

AddResource(String, String)

Source:
ResourceWriter.cs
Source:
ResourceWriter.cs

Adds a string as a named resource to the list of resources to be written to a file.

public:
 virtual void AddResource(System::String ^ name, System::String ^ value);
public void AddResource (string name, string? value);
public void AddResource (string name, string value);
abstract member AddResource : string * string -> unit
override this.AddResource : string * string -> unit
Public Sub AddResource (name As String, value As String)

Parameters

name
String

The resource name.

value
String

The string to add as a resource.

Implements

Exceptions

The name is null.

The resource list is null.

Remarks

The resources are not written until Generate() is called.

Applies to

AddResource(String, Stream, Boolean)

Source:
ResourceWriter.cs
Source:
ResourceWriter.cs

Adds a Stream as a named resource to the list of resources to be written to a file.

public void AddResource (string name, System.IO.Stream? value, bool closeAfterWrite = false);
public void AddResource (string name, System.IO.Stream value, bool closeAfterWrite = false);
member this.AddResource : string * System.IO.Stream * bool -> unit
Public Sub AddResource (name As String, value As Stream, Optional closeAfterWrite As Boolean = false)

Parameters

name
String

The resource name.

value
Stream

The stream to add as a resource.

closeAfterWrite
Boolean

An optional value that indicates whether, after resources have been written, the stream should be closed (true) or left open (false, the default value).

Remarks

The resources are not written until Generate() is called.

Applies to

AddResource(String, String, String)

Source:
PreserializedResourceWriter.cs
Source:
PreserializedResourceWriter.cs

Adds a resource of the specified type represented by a string value.

public:
 void AddResource(System::String ^ name, System::String ^ value, System::String ^ typeName);
public void AddResource (string name, string value, string typeName);
member this.AddResource : string * string * string -> unit
Public Sub AddResource (name As String, value As String, typeName As String)

Parameters

name
String

The resource name.

value
String

The value of the resource in string form understood by the type's TypeConverter.

typeName
String

The assembly qualified type name of the resource.

Remarks

If the type is a primitive type, the value will be converted using TypeConverter by the writer to that primitive type and stored in the resources in binary format. If the type is not a primitive type, the string value will be stored in the resources as a string and converted with a TypeConverter for the type when reading the resource. This conversion is done to avoid activating arbitrary types during resource writing.

Applies to