You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for pointing this out, @jack147527. The source code is incomplete in many instances here, unfortunately. We'll schedule some time to work on presenting compilable source in an uncoming sprint.
In the meantime, you'll need two additional classes to compile the example. The first is ConsoleSection:
public class ConsoleSection : ConfigurationSection
{
// Create a configuration section.
public ConsoleSection()
{ }
// Set or get the ConsoleElement.
[ConfigurationProperty("consoleElement")]
public ConsoleConfigElement ConsoleElement
{
get
{
return (
(ConsoleConfigElement) this["consoleElement"]);
}
set
{
this["consoleElement"] = value;
}
}
}
The second is ConsoleConfigElement:
public class ConsoleConfigElement : ConfigurationElement
{
// Create the element.
public ConsoleConfigElement()
{ }
// Create the element.
public ConsoleConfigElement(ConsoleColor fColor,
ConsoleColor bColor)
{
ForegroundColor = fColor;
BackgroundColor = bColor;
}
// Get or set the console background color.
[ConfigurationProperty("background",
DefaultValue = ConsoleColor.Black,
IsRequired = false)]
public ConsoleColor BackgroundColor
{
get
{
return (ConsoleColor)this["background"];
}
set
{
this["background"] = value;
}
}
// Get or set the console foreground color.
[ConfigurationProperty("foreground",
DefaultValue = ConsoleColor.White,
IsRequired = false)]
public ConsoleColor ForegroundColor
{
get
{
return (ConsoleColor)this["foreground"];
}
set
{
this["foreground"] = value;
}
}
}
There is a code missing issue in ConfigurationManager.OpenExeConfiguration Method.
ConsoleSection currentSection = null;
I think ConsoleSection class should be defined in the code. otherwise we could not run the GetRoamingConfiguration method.
The text was updated successfully, but these errors were encountered: