
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Reading Manifest Resources Programmatically
|
785
Console.WriteLine("\rResourceLocation: " + mri.ResourceLocation);
if (mri.ReferencedAssembly != null)
Console.WriteLine("\rReferencedAssembly: " +
mri.ReferencedAssembly.FullName);
}
}
Discussion
To obtain a ManifestResourceInfo object or objects, you must first call the
GetManifestResourceNames method on an Assembly object. This method returns an
array of
string objects, which contain the resource name. This resource name is then
passed in to the GetManifestResourceInfo method to obtain the ManifestResourceInfo
object. The ManifestResourceInfo object is what contains all the information about
the manifest resource.
The
ManifestResourceInfo.FileName property returns a fully qualified string describ-
ing the file that contains the manifest resource. This property will return an empty
string if the resource is embedded in the same assembly on which the
GetManifestResourceInfo
was called.
The
ManifestResourceInfo.ResourceLocation property returns all the ResourceLocation flags
for this resource. These flags can be one or a combination of three values described
in Table 13-4.
The final property of use in the
ManifestResourceInfo class is the ReferencedAssembly
property. This property returns an Assembly object that contains the resource. This
property ...