Show / Hide Table of Contents

Class NamedColorCollection

A collection of named colors

Inheritance
object
NamedColorCollection
Implements
IEnumerable<NamedColor>
IEnumerable
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.UI
Assembly: SadConsole.dll
Syntax
public class NamedColorCollection : IEnumerable<NamedColor>, IEnumerable

Constructors

NamedColorCollection()

Creates a new instance with the default colors of White and Black.

Declaration
public NamedColorCollection()

NamedColorCollection(IEnumerable<NamedColor>)

Declaration
public NamedColorCollection(IEnumerable<NamedColor> initialCollection)
Parameters
Type Name Description
IEnumerable<NamedColor> initialCollection

Properties

Colors

The backing dictionary of colors.

Declaration
public Dictionary<string, NamedColor> Colors { get; set; }
Property Value
Type Description
Dictionary<string, NamedColor>

Methods

Add(NamedColor)

Adds a color to the collection.

Declaration
public void Add(NamedColor color)
Parameters
Type Name Description
NamedColor color

GetEnumerator()

Declaration
public IEnumerator<NamedColor> GetEnumerator()
Returns
Type Description
IEnumerator<NamedColor>

Load(string)

Loads a Colors dictionary from a file, and returns a new instance of the NamedColorCollection class with those colors.

Declaration
public static NamedColorCollection Load(string file)
Parameters
Type Name Description
string file

The file.

Returns
Type Description
NamedColorCollection
Exceptions
Type Condition
FileNotFoundException

Thrown when the file isn't found.

LoadDefaults()

Clears the collection of colors and adds White and Black colors.

Declaration
public void LoadDefaults()

Save(string)

Saves the Colors dictionary to a file.

Declaration
public void Save(string file)
Parameters
Type Name Description
string file

The file.

Implements

IEnumerable<T>
IEnumerable

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX