I was browsing the colors class’s source in reflector and it’s just a sealed class. But all members are static. So why would anyone create a copy of the Colors class?
It lies inside:
System.Windows.Media.Colors
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A static class is just a sealed abstract class with
private constructorno constructors (as in, no constructors at any accessibility level, not even ones generated by the compiler) [fixed per Eric’s comment]. The C# keywordstaticis simply a shorthand for that, and also forces you to make all members static, but for API clients it’s exact same thing.Given that work on WPF (then Avalon) began before .NET 2.0 was released, it could be that this particular class was written before
static classappeared. Or perhaps the author was simply unaware of that language feature.