Class SortableManagedResourceItem
Instances of this class represent arbitrary managed resource items.
Inheritance
Implements
Inherited Members
Namespace: WizardWrx
Assembly: WizardWrx.Common.dll
Syntax
public class SortableManagedResourceItem : IComparable<SortableManagedResourceItem>
Remarks
This class is necessary because the public dictionary is opaque, so a consumer has no control over the order in which they are returned. Since this wrapper implements the IComparable interface, collections of these objects can be sorted.
Constructors
| Improve this Doc View SourceSortableManagedResourceItem()
Other than satisfying the requirements of the IList interface, the uninitialized object is useless.
Declaration
public SortableManagedResourceItem()
SortableManagedResourceItem(String, Object)
This constructor creates a fully initialized instance from the data in the Current property of the IDictionaryEnumerator object returned by a ResourceSet instance.
Declaration
public SortableManagedResourceItem(string pstrName, object pobjValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrName | Set the Name to the string returned by the Key property of the enumerator. |
System.Object | pobjValue | Set the Value to the System.object returned by the Value property of the enumerator. |
Properties
| Improve this Doc View SourceName
The Name is the Name shown in the property sheet grid into which garden variety managed string resources are input.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
TypeName
Since the full type specification is accessible through the Value property, and the string representation of the FullName is its most useful property, it gets its own read only property, which also returns just "string" for the common case, for which the prefix is redundant.
Declaration
public string TypeName { get; }
Property Value
Type | Description |
---|---|
System.String |
Value
The ResourceValue property is the Value property shown in the property sheet grid into which garden variety managed string resources are input, and its type is usually System.string.
Declaration
public object Value { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
| Improve this Doc View SourceGetInternalResourceName(String, Assembly)
Use the list of Manifest Resource Names returned by method GetManifestResourceNames on a specified assembly. Each of several methods employs a different mechanism to identify the assembly of interest.
Declaration
public static string GetInternalResourceName(string pstrResourceName, Assembly pasmSource)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrResourceName | Specify the name of the file from which the embedded resource was created. Typically, this will be the local name of the file in the source code tree. |
System.Reflection.Assembly | pasmSource | Pass a reference to the Assembly that is supposed to contain the desired resource. |
Returns
Type | Description |
---|---|
System.String | If the function succeeds, the return value is the internal name of the requested resource, which is fed to GetManifestResourceStream on the same assembly, which returns a read-only Stream backed by the embedded resource. If the specified resource is not found, it returns null. |
Remarks
Since I cannot imagine any use for this method beyond its infrastructure role in this class, I marked it private.
ListResourcesInAssemblyByName(Assembly, StreamWriter)
Call this static method from a console program to list the resources defined in an assembly alphabetically by name.
Declaration
public static void ListResourcesInAssemblyByName(Assembly pasmInWhichEmbedded, StreamWriter pswReportFile = null)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | pasmInWhichEmbedded | Specify the assembly that contains the resources to be enumerated. |
System.IO.StreamWriter | pswReportFile | Pass in a reference to an open StreamWriter to generate a tab-delimited report in addition to the console output. File output is suppressed when this parameter is null. |
Remarks
This method creates and consumes a generic List of instances of the class that hosts it, and uses string padding to vertically align the list without resorting to composite format items.
Explicit Interface Implementations
| Improve this Doc View SourceIComparable<SortableManagedResourceItem>.CompareTo(SortableManagedResourceItem)
Making the comparison based on the Name property permits sorting the resources in the most logical order.
Declaration
int IComparable<SortableManagedResourceItem>.CompareTo(SortableManagedResourceItem other)
Parameters
Type | Name | Description |
---|---|---|
SortableManagedResourceItem | other | The explicit implementation puts the burden of enforcing type safety on the runtime system. |
Returns
Type | Description |
---|---|
System.Int32 | Since it is a pass-through of another CompareTo method, the return type is guaranteed to adhere to the interface specification. |