Default value expressions

C# CONCEPTSA default expression returns the default value of a type.Learning ObjectivesThe article demonstrates how to useDefault OperatorDefault LiteralPrerequisitesExperience in basic concepts of C#.Install latest visual studio community edition.Getting StartedDefault OperatorThe default operator accepts only the name of a type or a type parameter.ExampleConsole.WriteLine(default(int)); // output: 0 Console.WriteLine(default(object) is null); // output: TrueExample with Genericsvoid DisplayDefaultOf<T>() { var … Continue reading Default value expressions

C# Safer Type Conversion

C# CONCEPTSUse of TryParse method for a safer type conversionPhoto by Lukas from PexelsLearning ObjectivesThe article demonstratesTryParse() Method for safe conversion.Protect against the loss of data while casting.PrerequisitesExperience with data types like string, int, decimal, float, and so on.Install latest visual studio community edition.Getting StartedWhen working with data, you’ll likely need to convert string data into … Continue reading C# Safer Type Conversion

Records Complete Guide — C# 9.0

C# CONCEPTSThe latest and most awaited feature records which allow you to design immutable data types.Photo by Expect Best from PexelsThe simplest way to imagine records as immutable classes. Feature-wise, they resemble tuples. In other words, custom tuples with properties and immutability.Consider the following example of a record which captures sign up details like first name, last … Continue reading Records Complete Guide — C# 9.0

Five Examples of Regular Expressions

C# CONCEPTSRegular Expressions render a robust, adaptable, and practical method for processing text.Quickly parse massive volumes of text to:Look for particular character models.Verify text to assure that it equals a defined pattern (such as an email address).Extract, edit, replace, or delete text substrings.Several applications that deal with strings or that parse large blocks of data, … Continue reading Five Examples of Regular Expressions

Best Practices for Regular Expressions

C# CONCEPTSThe RegEx engine in .NET is a robust, full-featured tool that processes text based on pattern matches.In most of the cases, RegEx engine performs pattern matching quickly and efficiently. However, in some cases, the engine may seem very lazy.The article describes some of the best practices that developers can adopt to ensure that regular expressions produce … Continue reading Best Practices for Regular Expressions

Exposing .NET Core library to COM

C# CONCEPTSLearn the process for exposing your .NET objects to COM and test the COM objects.What is COM?The Component Object Model (COM) defines a binary interoperability standard for creating reusable software libraries that interact at run time.“COM libraries can be used without the provision of compiling them into your application.”PrerequisitesInstall .NET Core 3.0 SDK or latest, if not installed … Continue reading Exposing .NET Core library to COM

Fluent Interface Design Pattern

C# CONCEPTSLearn to apply method chaining & conjunctions design pattern.Photo by Nate Grant on UnsplashWhat is Method Chaining?It’s used to link multiple methods calls into a single compound statement. Method Chaining requires that every method return an interface that supports chaining. It may take some time to get used to because even setters in a Fluent world … Continue reading Fluent Interface Design Pattern

Naming Guidelines

CODING STANDARDSLearn to follow a standard naming design pattern for any programming language.Photo by Fernando Hernandez on UnsplashFollowing a standard naming convention while coding can be a significant contribution to the project.A single project is shared across many developers. Beyond consistency of form, names of framework elements must be easily understood and must convey the function of … Continue reading Naming Guidelines

goto statement (C# Guide)

C# CONCEPTSThe goto statement assigns the program control to another statement.Photo by Lukas from PexelsLet’s understand the goto statement with the help of switch control. Consider the following example:A coffee machine that dispense three different sizes of coffee namely Small, Medium, and Large. Our goal is to calculate the total cost for each size.Let’s create an Enum … Continue reading goto statement (C# Guide)

Internal class v/s Internal member

C# CONCEPTSThe internal keyword is an access modifier for different types and type members.Video by Pressmaster from PexelsPrerequisitesLet’s first learn what all access modifiers available in C#.What is Access Modifier?The level controls whether they can be accessed from other code components in your assembly or different assemblies. Please find below the list of access modifiers available in … Continue reading Internal class v/s Internal member