CHAPTER 14 BUILDING AND CONFIGURING CLASS LIBRARIES
string textColor = (string)ar.GetValue("TextColor", typeof(string));
Console.ForegroundColor =
(ConsoleColor)Enum.Parse(typeof(ConsoleColor), textColor);
}
}
// Now print a message correctly.
for (int i = 0; i < numbOfTimes; i++)
Console.WriteLine("Howdy!");
Console.ReadLine();
}
Source Code The AppConfigReaderApp application can be found under the Chapter 14 subdirectory.
The Configuration File Schema Documentation
In this chapter, you were introduced to the role of XML configuration files. Here, we focused on a few
settings we can add to the element that control how the CLR will attempt to locate externally
required libraries. As you work on upcoming chapters of this book (and as you move beyond this book
and begin to build larger scale software), you will quickly notice that use of XML configuration files is
commonplace.
To be sure, the .NET platform uses *.config files in numerous APIs. For example, in Chapter 25, you
will see that Windows Communication Foundation (WCF) uses configuration files to establish complex
network settings. Later in this text when you examine web development via ASP.NET, you’ll quickly note
that the web.config file contains the same type of instructions as a desktop App.config file.
Because a given .NET configuration file can contain a large number of instructions, you should be
aware that the entire schema of this XML file is documented in the .NET help system. Specifically, if you
do a search for the topic “Configuration File Schema for the .NET Framework” in the help system, you
will be given a detailed explanation of each element (see Figure 14-25).
553