
C# optional parameters
C# 4.0 allows one to use named and optional parameters. Example: int Calculate(int x = 1, int y = 2) { int someNumber = 0; //some algorithm to calculate return someNumber * y * x + 5 * 0.5; }…
Practical guides on AI agents, LLM security, C#/.NET and Cloud, from Taswar Bhatti
Practical guides for developers, by Taswar Bhatti.

C# 4.0 allows one to use named and optional parameters. Example: int Calculate(int x = 1, int y = 2) { int someNumber = 0; //some algorithm to calculate return someNumber * y * x + 5 * 0.5; }…

The using statement in C# is a form of shortcut for try and finally block of code. Things to note is in order to use the using statement the object needs to implement the IDisposable interface, and using does not…

In interviews there is always the Singleton question, I personally refuse to answer it on interview. The reason is very simple I don’t code singletons anymore. I use my IoC Container to provide me with a singleton. Sorry if you…
Read more: I refuse to answer your stupid singleton question in interview

C# has the as keyword, it is mainly used to cast object of one type to another, and if it fails it should return a null rather than crashing the program or throwing exception. From MSDN documentation it states: You…

So C# what is the yield keyword? The yield keyword in C# is basically an iterator, its a form of syntactic sugar added from C# 2.0 to create IEnumerable and IEnumerator objects, thus returning one element at a time. From…