Safely cast using pattern matching

C# CONCEPTSThe article clarifies the difference between “is” & “as” operators and helps consolidate them into applications as efficiently as possible.Learning ObjectivesHow to use the “is” operatorHow to use the “as” operatorPrerequisitesInstall Visual Studio or Visual Studio Code.Knowledge about basic C# concepts.Getting StartedLet’s use the latter code as an example.Test s = new Test();object c … Continue reading Safely cast using pattern matching

Sealed v/s Abstract Classes

C# CONCEPTSThe article demonstrates the use of abstract and sealed classPhoto by Sabrina Gelbart from PexelsLearning ObjectivesWhat is a Sealed classWhat is an Abstract classPrerequisitesRequire a basic understanding of OOPS concepts.Getting StartedSealed ClassThe sealed keyword permits restriction of the inheritance of a class or its members.To mark a class as sealed, put the keyword sealed before the … Continue reading Sealed v/s Abstract Classes

String Concatenation Overloads

C# CONCEPTSDifferent string concatenation overloads available.With the “String” class, concatenate the following types:One or more instances of strings.One or more instances of objects.The string representation of values like an array.Overloads availablePlease find below the List of overloads available.https://gist.github.com/ssukhpinder/b6b2073fe5b6ec09d5c598f67392dc0bLet’s test some overloadsExample 1 — Concat<T>(IEnumerable<T>)Concatenates the members of an IEnumerable<T> implementation.Consider an entity of vehicle with attributes engine … Continue reading String Concatenation Overloads

What are Default Interfaces? C# 8.0

C# CONCEPTSBeginning with C# 8.0, you can define an implementation when you declare a member of an interface.What is the default interfaces?An interface that permits the interface to showcase a “default” implementation for the method in classes that do not provide an overriding implementation.ExampleThe primary example of default interface in C# 8.0interface IExample { void … Continue reading What are Default Interfaces? C# 8.0