System.Resources.ResourceManager.GetStream Method

Returns an unmanaged memory stream object from the specified resource, using the specified culture.

Syntax

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

Parameters

name
The name of a resource.
culture
An object that specifies the culture to use for the resource lookup. If culture is null, the culture for the current thread is used.

Returns

An unmanaged memory stream object that represents a resource.

Remarks

The ResourceManager.GetStream(string, System.Globalization.CultureInfo) 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 culture that is specified by culture, or for the culture that is specified by the System.Globalization.CultureInfo.CurrentUICulture property if culture is null. 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