There are a variety of reasons one might want to get a resource associated with an
enum element. For example, it might be necessary to find an error message to display to a user or return in a web service call. Or, perhaps you need to find an icon associated with a status, etc. This article shows how to find a string from a resource file . . .
Enums Can Behave Like Constants
The C# .NET language has constants, and it has variables. A constant is essentially a value that is known at compile-time, whereas a variable is essentially a placeholder of a specific type for a value that can change at runtime. An
enum is a bit of an anomaly because it defines a type with unique set of elements backed by an integer type . . .
A Really Cool Way to Raise Events
I have previously written an article on extensions methods, which included some information about using generics with extension methods. Since that time, I have stumbled across something I did not previously realize:
If the compiler can figure out the generic type from one of the parameters passed into the extension method, you . . .
In a multi-threaded application, synchronization is key to protect data integrity. There are numerous ways to accomplish data synchronization in .NET and C#, such as the commonly used
System.Threading.Monitor .NET Framework class and corresponding C#
lock statement. But, when it comes to super-fast synchronization, nothing beats the . . .
One Relay Does It All
Extension methods have been part of the C# programming language since .NET 3.5 / Visual Studio 2008. An extension method is really nothing more than just a static method of a static class that can be called in a special way. In addition to being able to call an extension method directly by specifying the class and method . . .
The C# language has several different uses for question marks. To programmers unfamiliar with these uses, it can be a bit confusing. However, once you know and understand them, they become second nature just like
||Conditional . . .|