Handling Nullable values in LINQ queries.

Suppose we have PhoneNum (nullable integer property) in Customer class
Public int PhoneNum {get;set;}

Check Null in lamda expression like below.

Public Ienumerable<Customer> GetCutomers(List<Customer> custList)
var query=custList.Where(c => (c.PhoneNum ?? false)== false);


Creating and saving a text file – C#

// Pass a path and filename to the StreamWriter’s
// constructor. The path must already exist but the
// file will be created if it does not already exist.
using (TextWriter tw = new StreamWriter(“c:\\foo\\bar.txt”))
tw.WriteLine(“hello world”);

By Sriramjithendra Posted in C#.NET

String Extensions – C#

Using built-in string methods can help us get the desired result but you repeat the code everywhere in need and I felt isolating the logic to one place will help the logic maintainable and testable. We can have all the below methods in a class file. (StringExtensions ) Continue reading

TransactionScope Class

In the real world any one you will find exceptional scenarios, exceptional issues where only a knowledge of how to useTransactionScope is not good enough. To resolve transactional issues like deadlocks, timeouts, etc., you must know each and every concept directly/indirectly related to a transaction. Continue reading

By Sriramjithendra Posted in C#.NET

Temporary Tables in SQL Server

Temporary tables can be created at runtime and can do the all kinds of operations that one normal table can do. But, based on the table types, the scope is limited. These tables are created inside tempdb database.

SQL Server provides two types of temp tables based on the behavior and scope of the table. These are: