System.Resources.ResourceManager.GetStream Method

Returns an unmanaged memory stream object from the specified resource.

Syntax

[System.Runtime.InteropServices.ComVisible(false)]
public System.IO.UnmanagedMemoryStream GetStream (string name)

Parameters

name
The name of a resource.

Returns

An unmanaged memory stream object that represents a resource .

Remarks

The ResourceManager.GetStream(string) method takes the name of a resource that is stored as a System.IO.MemoryStream object, gets the value of the object resource, and returns an System.IO.UnmanagedMemoryStream object. It requires that you work directly with a stream of bytes, which you then convert to an object. This method is useful primarily for performance reasons: Retrieving a resource as a byte stream instead of an explicit object can improve performance.

The returned resource is localized for the UI culture of the current thread, which is defined by the System.Globalization.CultureInfo.CurrentUICulture property. If the resource is not localized for that culture, the resource manager uses fallback rules to load an appropriate resource. If no usable set of localized resources is found, the System.Resources.ResourceManager falls back on the default culture's resources. If a resource set for the default culture is not found, the method throws a System.Resources.MissingManifestResourceException exception or, if the resource set is expected to reside in a satellite assembly, a System.Resources.MissingSatelliteAssemblyException exception. If the resource manager can load an appropriate resource set but cannot find a resource named name, the method returns null.

The ResourceManager.IgnoreCase property determines whether the comparison of name with the names of resources is case-insensitive (the default) or case-sensitive.

Requirements

Namespace: System.Resources
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0