C#: LINQ – Set Operator

Please see my other LINQ articles. Use LINQ to update values during a query. This article will demonstrate how to perform a SET, similar to sql SET during a query. First, I’ll populate a List<T> collection of Person objects. Now, I’ll call ForEach() on each person object, assigning the length of FirstName to the FNameLen property of…

C#: LINQ – Filtering by Custom Extension

Please see my other LINQ articles. Extending LINQ to perform custom searches In this article, I’ll demonstrate how to create a custom extension in LINQ which may be used to extend searching capability on collections. In my C#: Json – Populate objects from a file I demonstrated how to read objects from a file. Now, I’ll update…

C#: Json – Populate objects from a file

Please see my other C# articles. Reading data from a file into objects In this article I’ll demonstrate how to use Json to read a file’s contents and populate a list of objects with that data. First, I’ll create a method which uses reads data from a Json file into a string, which Json then uses to…

C#: File I/O – Populate objects from a file

Please see my other C# articles. Reading data from a file into objects In this article I’ll demonstrate how to read a file’s contents and populate a list of objects with that data. First, I’ll create a method which uses reads data from a Json file into a string, which Json then uses to uses to convert…

C# Method Expression-bodied Syntax

Please see my other C# articles. Simplify single-statement methods When writing methods with contain only a single statement, you can avoid curly braces and a return statement by using expression-bodied syntax. Similar to lambda expression, append the “fat arrow” after the method signature and provide the single statement. Note: Less space and code is required to perform…

C#: Method named parameters

Please see my other C# articles. Improve readability when invoking method parameters In this article, I’ll demonstrate how to explicitly invoke method parameters and optionally change the parameter order. In the following overloaded method, I have two pameters. When I invoke this method, I want to clarify which argument is sent to the multiplier verses the array…

C#: String Interpolation

Please see my other C# articles. Use strings in an easier, less-error prone way In this article I’ll demonstrate how to integrate string values into a statement which reduces potential errors and produces more readable statements. Note: Using interpolation, there’s no need to open/close variables within the statement. Also, to use interpolation, you must precede the statement…

C#: Method optional parameter

Please see my other C# articles. Declare default value for a parameter to make it optional In this article I’ll demonstrate how to make method parameters optional to add flexibility when invoking methods. To make a parameter optional, simply declare a default value for it in the signature. Then, during invocation, any parameters which don’t receive a…

C#: Method params keyword

Please see my other C# articles. Using params to receive unknown quantity of arguments In this article, I’ll demonstrate how to configure a method signature to receive a amount of arguments unknown at design time. I’ll begin with an array of lottery picks I want to display on the screen. Now, I want a method which receives…

Visual Studio: .NET Garbage Collection

View the garbage collection in action In this article I will demonstrate the .NET garbage collection working. First, I’ll setup a loop which instantiates 10,000,000 Person objects using named parameters. Next, I’ll set a breakpoint at the curly brace immediately below (outside of) the for() loop. Now I’ll invoke the Diagnostic tools (Debug -> Windows…