Retrieves the type name and data of a named resource from an open resource file or stream.
Assembly: mscorlib (in mscorlib.dll)
public void GetResourceData( string resourceName, out string resourceType, out byte resourceData )
- Type: System.String
The name of a resource.
- Type: System.String
When this method returns, contains a string that represents the type name of the retrieved resource (see the Remarks section for details). This parameter is passed uninitialized.
- Type: System.Byte
When this method returns, contains a byte array that is the binary representation of the retrieved type. This parameter is passed uninitialized.
resourceName is null.
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.
The method retrieves the value of a named resource as a byte array. It is typically used when the Value property throws an exception when it tries to retrieve the value of a resource.
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 ResourceTypeCode enumeration member that indicates the data type of the resource. ResourceTypeCode is a private enumeration that is used by Resgen.exe.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 ResourceTypeCode enumeration includes the values shown in the following table.
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 null.
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 resourceData argument (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 Person type in the Extensions namespace, 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=188.8.131.52, Culture=neutral, PublicKeyToken=null
Assuming that resourceData has not been corrupted and that the source type is available, resourceData can 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.