Reader. Get Resource Data(String, String, Byte) Method
Retrieves the type name and data of a named resource from an open resource file or stream.
public: void GetResourceData(System::String ^ resourceName, [Runtime::InteropServices::Out] System::String ^ % resourceType, [Runtime::InteropServices::Out] cli::array <System::Byte> ^ % resourceData);
public void GetResourceData (string resourceName, out string resourceType, out byte resourceData);
member this.GetResourceData : string * string * Byte -> unit
Public Sub GetResourceData (resourceName As String, ByRef resourceType As String, ByRef resourceData As Byte())
The name of a resource.
When this method returns, contains a string that represents the type name of the retrieved resource. This parameter is passed uninitialized.
When this method returns, contains a byte array that is the binary representation of the retrieved type. This parameter is passed uninitialized.
resourceName does not exist.
resourceName has an invalid type.
The retrieved resource data is corrupt.
The current ResourceReader object is not initialized, probably because it is closed.
resourceType is a string that represents the data type of the resource. It can be any of the following values:
The string representation of a
ResourceTypeCodeenumeration member that indicates the data type of the resource.
ResourceTypeCodeis a private enumeration that is used by .to indicate that a special binary format is used to store one of 19 common data types. These include the .NET Framework primitive data types (Boolean, Byte, Char, Decimal, Double, Int16, Int32, Int64, Single, SByte, UInt16, UInt32, UInt64), as well as String, DateTime, and TimeSpan, In addition, the
ResourceTypeCodeenumeration includes the values shown in the following table.
ResourceTypeCode value Description
The data is a byte array. This data type commonly results from the call to the ResourceWriter.AddResource(String, Byte) method.
The data is a null reference. This data type commonly results from the call to the ResourceWriter.AddResource(String, Object) method with an object whose value is
The data is stored in a stream. This data type commonly results from the call to the ResourceWriter.AddResource(String, Stream) or ResourceWriter.AddResource(String, Stream, Boolean) method.
A string that contains the fully qualified name of the type whose serialized data is assigned to the
resourceDataargument (for example,
System.String). In addition, for types that are not part of the .NET Framework class library, the string includes the name, version, culture, and public key of the assembly that contains the type. For example, the following string indicates that the serialized data represents an instance of the
Persontype in the
Extensionsnamespace, which is found in version 1.0 of an assembly named Utility that has no public key and no designated culture.
Extensions.Person, Utility, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null
resourceDatahas not been corrupted and that the source type is available,
resourceDatacan be converted from a byte array back to its original value by converting the byte array to a Stream object and passing the stream to the BinaryFormatter.Deserialize method.
The string used to describe the data type in the ResourceWriter.AddResourceData method call.