OOP: Interfaces Ensure Consistent Behavior

Please see my other Object-Oriented Programming (OOP) articles. Apply Contracts Between Objects with Interfaces In this article I’ll demonstrate how to ensure consistent behavior when designing an application. I’m going to build an airport that only accepts types of craft which behave in a consistent manner. Also, when the airport is in operation, I want to ensure…

ASP.NET Core: appsettings.json

Using AppsSettings.Json to Store/Retrieve data In this article I’ll demonstrate how to use Microsoft’s replacement configuration file to web.config, appsettins.json. Similar to all .json files, this change means much easier config file for projects due to its simple attribute–value pairs and arrays format, over the highly proprietary web.config file format, which changes often with each…

C# Interfaces – Extending Behavior

Architecting Behavior for Extensibility When designing class behavior, it’s important to remember in the implementation of those objects, future changes are certain, necessitating flexibility to evolving requirements. Extensibility in Design When designing behavior in classes, you can simply define functions to be used as object methods, but that assumes the details of each function need…

C# Language Integrate Query (LINQ)

Please see my other C# articles. LINQ – All to test a collection LINQ – Any() to test a collection   LINQ: Call Custom Method LINQ – Distinct for unique values LINQ – Equality Comparer LINQ: Filtering by Custom Extension LINQ: Query LINQ: Set Operator LINQ: Skip N number objects LINQ: SkipWhile to get objects…

C#: LINQ – Equality Comparer

Please see my other LINQ articles. Implement an Equality Comparer to customize Contains(). In this article I’ll demonstrate how to override Contains() when searching a collection to specify which properties of objects to search. First, I’ll get a collection of static People objects. Now, I’ll implement a custom Equality Comparer class where I’ll override Equals() to search…

C#: LINQ – Any() to test a collection

Please see my other LINQ articles. Use Any() to test an entire collection. In this article I’ll demonstrate how to use Any() to determine any object in the collection matches a search predicate. First, I’ll get a collection of static People objects. In the statement, I apply Any() on the people objects’ FirstName property to determine if…

C#: LINQ – All() to test a collection

Please see my other LINQ articles. Use All() to test an entire collection. In this article I’ll demonstrate how to use All() to determine if the entire collection matches a search predicate. First, I’ll get a collection of static People objects. In the statement, I apply All() on the people objects’ LastName property to determine if…

C#: LINQ – Distinct to get unique values

Please see my other LINQ articles. Use Distinct() during select to retrieve a unique list. In this article I’ll demonstrate how to use Distinct() during Select() to generate a unique list of car makes. First, I’ll get a collection of static Car objects. In the section statement, I perform a select on the car objects’ Make property,…

C#: LINQ – SkipWhile to get objects

Please see my other LINQ articles. Use SkipWhile() to include a condition for skipping objects. In this article I’ll demonstrate how to use SkipWhile() to set a condition on which to skip objects when building a collection. First, I’ll get a collection of static Person objects. Now I’ll call SkipWhile() on my collection using Method syntax and…