NamedColorCollection Class
Definition
Section titled “Definition”A collection of named colors
public class NamedColorCollection : IEnumerable<NamedColor>, IEnumerableInheritance object
Implements IEnumerable<NamedColor>, IEnumerable
Constructors
Section titled “Constructors”NamedColorCollection()
Section titled “NamedColorCollection()”Creates a new instance with the default colors of White and Black.
public NamedColorCollection()NamedColorCollection(IEnumerable<NamedColor>)
Section titled “NamedColorCollection(IEnumerable<NamedColor>)”public NamedColorCollection(IEnumerable<NamedColor> initialCollection)Parameters
Section titled “Parameters”initialCollection IEnumerable<NamedColor>
Properties
Section titled “Properties”Colors
Section titled “Colors”The backing dictionary of colors.
public Dictionary<string, NamedColor> Colors { get; set; }Methods
Section titled “Methods”Add(NamedColor)
Section titled “Add(NamedColor)”Adds a color to the collection.
public void Add(NamedColor color)Parameters
Section titled “Parameters”color NamedColor
LoadDefaults()
Section titled “LoadDefaults()”Clears the collection of colors and adds White and Black colors.
public void LoadDefaults()Load(string)
Section titled “Load(string)”Loads a Colors dictionary from a file, and returns a new instance of the NamedColorCollection class with those colors.
public static NamedColorCollection Load(string file)Parameters
Section titled “Parameters”file string
The file.
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”FileNotFoundException
Thrown when the file isn’t found.
Save(string)
Section titled “Save(string)”Saves the Colors dictionary to a file.
public void Save(string file)Parameters
Section titled “Parameters”file string
The file.
GetEnumerator()
Section titled “GetEnumerator()”public IEnumerator<NamedColor> GetEnumerator()