Category: C#

Sep 14

C# Interview Questions

Interview questions

In this article I am sharing questions related to C#. I have segregated the most frequently asked questions into different sub types. These C# interview questions are generally helpful for candidate having experience 2-7 years. The candidate who are aspirant for lead role should focus more on OOPS concepts. In OOPS concepts, interviewer may ask …

Continue reading »

Sep 09

GZip Compression and Decompression in C#

In .NET GZipStream class in System.IO.Compression provides methods and properties to compress and decompress streams. Below example shows how to compress and decompress large binary data   CompressorHelper.cs public class CompressorHelper { public static byte[] DecompressGZip(byte[] bytesToDecompress) { using (var stream = new GZipStream(new MemoryStream(bytesToDecompress), CompressionMode.Decompress)) { const int size = 4096; var buffer = new byte[size]; …

Continue reading »

Aug 15

Export Data to CSV using C#

In this article I would like to show how to export datatable and list to CSV File (Comma Separated Values). CSV file is a text based file which contains data are separated by comma. CSV file can also open’s in Microsoft Excel. To create CSV file, we need to write data to Response object of …

Continue reading »

Aug 15

Export Data to Word using C#

In this article I would like to show how to export datatable to Microsoft Word File using OPEN XML API. To create Excel file, we need to write data to Response object of HttpContext. The content type used should be “application/msword” Here I will create file in windows temp (Run > %temp%) folder and write …

Continue reading »

Aug 15

Export Data to Excel using C#

In this article I would like to show how to export datatable to Microsoft Excel File using OPEN XML API. To create Excel file, we need to write data to Response object of HttpContext. The content type used should be “application/x-msexcel” Here I will create file in windows temp (Run > %temp%) folder and write …

Continue reading »