Gorgon
Show / Hide Table of Contents

Struct GorgonFileExtension

An extension and description for a file.

Implements
IEquatable<GorgonFileExtension>
IComparable<GorgonFileExtension>
IEquatable<string>
IComparable<string>
IGorgonNamedObject
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
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 Source

GorgonFileExtension(string)

Initializes a new instance of the GorgonFileExtension struct.

Declaration
public GorgonFileExtension(string extension)
Parameters
Type Name Description
string extension

The extension.

| Edit this page View Source

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 Source

Description

The description of the file type.

Declaration
public readonly string Description
Field Value
Type Description
string
| Edit this page View Source

Extension

The file extension without the leading period.

Declaration
public readonly string Extension
Field Value
Type Description
string

Properties

| Edit this page View Source

FullExtension

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.

| Edit this page View Source

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 Source

CompareTo(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 other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.

| Edit this page View Source

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 other parameter.Zero This object is equal to other. Greater than zero This object is greater than other.

Exceptions
Type Condition
NotImplementedException
| Edit this page View Source

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 other parameter; otherwise, false.

| Edit this page View Source

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.

| Edit this page View Source

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
ValueType.Equals(object)
| Edit this page View Source

Equals(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 other parameter; otherwise, false.

| Edit this page View Source

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
ValueType.GetHashCode()
| Edit this page View Source

ToString()

Returns a string that represents this instance.

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents this instance.

Overrides
ValueType.ToString()

Operators

| Edit this page View Source

operator ==(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Implements

IEquatable<T>
IComparable<T>
IEquatable<T>
IComparable<T>
IGorgonNamedObject

Extension Methods

GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author