# C# .NET Enum, Constant and Static ReadOnly

### Enums Can Behave Like Constants

Tim Leffelman

Programmer, Engineer

June 23, 2017

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 . . .

# C# .NET -- Implied Generics in Extension Methods

### A Really Cool Way to Raise Events

Tim Leffelman

Programmer, Engineer

February 09, 2017

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 . . .

# .NET Interlocked Operations

Tim Leffelman

Programmer, Engineer

February 09, 2017

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 . . .

# Functional Devices - RIBU1CW

### One Relay Does It All

Tim Leffelman

Programmer, Engineer

February 07, 2017

I have recently come across a pretty cool product for anybody interested in home automation. I am, in fact, using one of these devices myself to control the clothes dryer booster fan that I recently added to my crawl space. It is the Functional Devices RIB (Relay-In-Box) RIBU1CW:

. . .

# C# Extension Methods

Tim Leffelman

Programmer, Engineer

May 24, 2016

# Introduction

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 . . .

# C# Question Mark Alias and Operators

Tim Leffelman

Programmer, Engineer

December 10, 2015

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 && and ||.

Operator Name VS C# Framework
a?b:c Conditional . . .

# C# Methods with Multiple Boolean Arguments

### Several Different Ways to Deal with It

Tim Leffelman

Programmer, Engineer

October 23, 2015

Every once in awhile, the need seems to arise to create a method that takes a large number of boolean arguments. The method prototype would like something like the one shown below.

void MyMethod(
bool a,
bool b,
bool c,
bool d
);


From a usage viewpoint, it's generally a bad idea to put too many . . .