Struct GorgonFileExtension
An extension and description for a file.
Implements
Inherited Members
Namespace: Gorgon.IO
Assembly: Gorgon.Core.dll
Syntax
public readonly struct GorgonFileExtension : IEquatable<GorgonFileExtension>, IComparable<GorgonFileExtension>, IEquatable<string>, IComparable<string>, IGorgonNamedObject
Remarks
This type allows for easy manipulation of file extensions and their descriptions when populating a file dialog extension list.
The file extensions can be compared to each other to determine uniqueness. When comparing file extensions, the comparison is done with a case-insensitive comparer.
Constructors
| Edit this page View SourceGorgonFileExtension(string)
Initializes a new instance of the GorgonFileExtension struct.
Declaration
public GorgonFileExtension(string extension)
Parameters
Type | Name | Description |
---|---|---|
string | extension | The extension. |
GorgonFileExtension(string, string)
Initializes a new instance of the GorgonFileExtension struct.
Declaration
public GorgonFileExtension(string extension, string description)
Parameters
Type | Name | Description |
---|---|---|
string | extension | The extension. |
string | description | The description. |
Fields
| Edit this page View SourceDescription
The description of the file type.
Declaration
public readonly string Description
Field Value
Type | Description |
---|---|
string |
Extension
The file extension without the leading period.
Declaration
public readonly string Extension
Field Value
Type | Description |
---|---|
string |
Properties
| Edit this page View SourceFullExtension
Property to return the fully qualified extension.
Declaration
public string FullExtension { get; }
Property Value
Type | Description |
---|---|
string |
Remarks
This property is the same as the Extension value, except it is prefixed with a period.
IsEmpty
Property to return whether the extension is empty or not.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceCompareTo(GorgonFileExtension)
Compares the current object with another object of the same type.
Declaration
public int CompareTo(GorgonFileExtension other)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
int | A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the |
CompareTo(string)
Compares the current object with another object of the same type.
Declaration
public int CompareTo(string other)
Parameters
Type | Name | Description |
---|---|---|
string | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
int | A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the |
Exceptions
Type | Condition |
---|---|
NotImplementedException |
Equals(GorgonFileExtension)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GorgonFileExtension other)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(GorgonFileExtension, GorgonFileExtension)
Function to return if instances are equal.
Declaration
public static bool Equals(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if equal, false if not. |
Equals(object)
Determines whether the specified object, is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to this instance; otherwise, false. |
Overrides
| Edit this page View SourceEquals(string)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(string other)
Parameters
Type | Name | Description |
---|---|---|
string | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
| Edit this page View SourceToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents this instance. |
Overrides
Operators
| Edit this page View Sourceoperator ==(GorgonFileExtension, GorgonFileExtension)
Operator to return whether 2 instances are equal.
Declaration
public static bool operator ==(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if equal, false if not. |
operator >(GorgonFileExtension, GorgonFileExtension)
Operator to return whether one instance is greater than the other.
Declaration
public static bool operator >(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if greater than, false if not. |
operator >=(GorgonFileExtension, GorgonFileExtension)
Operator to return whether one instance is greater than or equal to the other.
Declaration
public static bool operator >=(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if greater or equal, false if not. |
operator !=(GorgonFileExtension, GorgonFileExtension)
Operator to return whether 2 instances are not equal.
Declaration
public static bool operator !=(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if not equal, false if equal. |
operator <(GorgonFileExtension, GorgonFileExtension)
Operator to return whether one instance is less than the other.
Declaration
public static bool operator <(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if less than, false if not. |
operator <=(GorgonFileExtension, GorgonFileExtension)
Operator to return whether one instance is less or equal to the other.
Declaration
public static bool operator <=(GorgonFileExtension left, GorgonFileExtension right)
Parameters
Type | Name | Description |
---|---|---|
GorgonFileExtension | left | Left instance to compare. |
GorgonFileExtension | right | Right instance to compare. |
Returns
Type | Description |
---|---|
bool | true if less than or equal, false if not. |