Design Pattern – Adapter

C# CONCEPTSAccording to Gang of Four, the Adapter Pattern converts the interfaces of a class into interfaces that the client requires.In other words, the adapter design pattern helps incompatible interfaces work collectively.Photo by Brett Sayles from PexelsUse CaseLet's consider an example of two organizations merging; X organization is taking over Y, but while combining code, the … Continue reading Design Pattern – Adapter

Connection Leak in MSSQL

MSSQLThe error occurs as a result of connection leaks in the application.Photo by panumas nikhomkhai from PexelsAny applications getting connection timeouts to MS-SQL Server will see the following error.Message=Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and the max … Continue reading Connection Leak in MSSQL

Design Pattern – Builder

C# CONCEPTSAccording to Gang of Four, a creational pattern “Builder” allows to separate and reuse a specific method to build something.Photo by Andrea Piacquadio from PexelsUse CaseLets us take an example of a Car, and the user wanted to build two models, i.e., SUV and Sedan.Builder design pattern comes in handy in the above use case, … Continue reading Design Pattern – Builder

Design Pattern – Observer

C# CONCEPTSAccording to Gang of Four, observer pattern defines dependency b/w two or more objects. So when one object state changes, then all its dependents are notified.Photo by Christina Morillo from PexelsIn other words, a change in one object initiates the notification in another object.Use CaseLet’s take an example of an Instagram celebrity influence who has … Continue reading Design Pattern – Observer

Box Selection – Visual Studio C#

VISUAL STUDIO TIPSEdit multiple lines of code at the same timeTip 1: Box SelectionLet’s take an example of the following class with integer properties and apply box selection to update int to, let's say, double at one shot.public class Test { int x = 10; int y = 20; int z = 30; int l = 40;}Shortcut … Continue reading Box Selection – Visual Studio C#

Brace Matching – Visual Studio C#

VISUAL STUDIO TIPSCool visual studio tips for productivityPhoto by Shotkit from PexelsWhat is Brace Matching?As C# uses angular braces quite extensively, brace matching helps you identify the corresponding brace pair by highlighting it as shown below.By default, the visual studio uses a gray color highlighter to show brace matching, but the user can override the setting.Tip 1: … Continue reading Brace Matching – Visual Studio C#

Design Pattern – Iterator

C# CONCEPTSAccording to Gang of Four, the iterator pattern provides a process to obtain the aggregator object without knowing its implementation.Use CaseLet us take an example of a collection list of cars and string[] an array of motorcycles, we need to design an aggregator object so that one can iterate over the collection without knowing … Continue reading Design Pattern – Iterator

Design Pattern – Decorator

C# CONCEPTSAccording to Gang of Four, the pattern adds extra responsibilities to a class object dynamically.Photo by Jonas Svidras from PexelsUse CaseLet’s consider the example of buying a car worth ten lakhs; the company provides the following additional featuresSunroofAdvance Music Systemand many moreWith some additional features, the total price of the car increases. Let’s implement the … Continue reading Design Pattern – Decorator

Design Pattern – Singleton

C# CONCEPTSGang of Four - Singleton design pattern ensures that a particular class has only one instance/object and a global access point.Photo by Sebastian Voortman from PexelsPrerequisitesBasic knowledge of OOPS concepts.Any programming language knowledge.The article demonstrates the usage of singleton design patterns using the C# programming language. So, to begin with, C#Learning ObjectivesHow to code using a … Continue reading Design Pattern – Singleton

Linear Search .Net

DATA STRUCTURESSearches particular value within a data structure.Photo by clark Cruz from PexelsBackgroundLinear search checks each element in the list until a match is found or until it reaches the end.Linear Search FunctionConsider the linear function as “LinearSearch(arr,value)”where arr is the array to search inside ofwhere value is the element, we are searching for in array “arr.”OutputReturns … Continue reading Linear Search .Net