System.Resources.ResourceManager.GetStream Method

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


public System.IO.UnmanagedMemoryStream GetStream (string name, System.Globalization.CultureInfo culture)


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


An unmanaged memory stream object that represents a resource.


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.


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