Прочетете на английски Редактиране

Споделяне чрез


IResourceWriter.AddResource Method

Definition

Adds a resource to the list of resources to be written to an output file or output stream.

Overloads

AddResource(String, Byte[])

Adds an 8-bit unsigned integer array as a named resource to the list of resources to be written.

AddResource(String, Object)

Adds a named resource of type Object to the list of resources to be written.

AddResource(String, String)

Adds a named resource of type String to the list of resources to be written.

AddResource(String, Byte[])

Adds an 8-bit unsigned integer array as a named resource to the list of resources to be written.

C#
public void AddResource(string name, byte[]? value);
C#
public void AddResource(string name, byte[] value);

Parameters

name
String

Name of a resource.

value
Byte[]

Value of a resource as an 8-bit unsigned integer array.

Exceptions

The name parameter is null.

Remarks

The resources are not written until the Generate method is called.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

AddResource(String, Object)

Adds a named resource of type Object to the list of resources to be written.

C#
public void AddResource(string name, object? value);
C#
public void AddResource(string name, object value);

Parameters

name
String

The name of the resource.

value
Object

The value of the resource.

Exceptions

The name parameter is null.

Remarks

The resource is not written until the Generate method is called.

Бележка

value might have to be serializable, so you might have to provide a type converter, depending on which resource writer is used.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

AddResource(String, String)

Adds a named resource of type String to the list of resources to be written.

C#
public void AddResource(string name, string? value);
C#
public void AddResource(string name, string value);

Parameters

name
String

The name of the resource.

value
String

The value of the resource.

Exceptions

The name parameter is null.

Remarks

The resource is not written until the Generate method is called.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1