C# Extension method: Searching lines containing specific string

Searching for lines in text file containing a specific string can be very handy with below code snippet. This method is very optimal specially if we are accessing log/error/access files.

Usage:

The method can be further improvised to search lines in text files with in a directory containing the specific string.

Logging Exceptions In-Depth

Exceptions are safeguards to deal with any unexpected or exceptional situations and logging them helps finding the root cause of issues during runtime. Significance of logging becomes even more critical on production where resources to debug are very scarce. So, to have in-depth information on what gone wrong and where play a very important role …

Resize Image – Programmatically

Thinking of resizing an image programmatically? Pretty simple straight forward. Once done, the process can be use to resize images in bulk without any human intervention & third party software. Below is the C# implementation to do the same:

This implementation can be further improvise to generate various device specific renditions for an image. …

StreamHandler Read Bytes

Getting bytes from a stream or file is quite a normal scenario & once you are able to retrieve the bytes, it can be saved in database as BLOB content as well. This is very handy way of storing any file type (text, audio, video, pdf, etc.) and then play around. Below is C# implementation …