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…

Refactoring: Cheat-Sheet

Please visit my other Object-Oriented Programming articles. Reaping the most benefits from refactoring Use the following quick cheat-sheet when refactoring. Topic Task Remove unhelpful comments Remove comments which state the obvious or replace unfocussed blocks of code with clearly-named methods following the Singe Responsibility Principle (SRP).Remove zombie code – code commented-out to no longer be…

Visual Studio: Code Metrics

Please see my other Miscellaneous articles. Using Visual Studio to guide refactoring Visual Studio provides the following powerful metrics to help guide developers as they seek opportunities for refactoring. To begin the code metrics analyzer, r-click the project -> Analyze and Code Cleanup -> Calculate Code Metrics. You will then be presented with a code hierarchy…

MVC: Passing Query String Values in a View

Please see my other MVC articles. Building Links from Model Data This article illustrates how to build a link within an MVC view which passes model data as a query string variable. First, I begin with my “model” statement exposing my RaveUser model’s properties. Next, I provide an ActionLink() statement with text for the link (“Reload All…

MVC: Parsing a URL

Please see my other MVC articles. Using URL Properties in a page MVC, ASP.NET, and IIS provide a very easy and effective way to interpret data contained within the current URL.By simply creating a method with the appropriately named parameters (order doesn’t matter), that method may parse data contained within the URL.

Telerik Reports

Please see my other Business Intelligence articles. Telerik Reports Conditional Background-Partial Cell Conditionally Display Data Customized Layout Display Clickable Links Display Username in Report Filtered Columns Pass Parameters to a Report Reuse Empty Space Multilevel Groups Use HTML Textbox