Skip to main content

C#

How to use the ConfigurationManager Class in Visual Studio?

Posted in

Why don’t I see the ConfigurationManager Class?
Whats wrong with ConfigurationManager class why don’t I see it?

FileSplitter Tool in C#

Posted in

File Splitter Utility in C#

I had to come across a situation where I had to cut a large single .csv file containing 2.2 Million records into smaller files. Initially I thought of using already available split tool to do it, but then decided to write my own File Splitter tool in C#.  Thats how I came up with this tool. The File Splitter Tool takes an input file and splits it into multiple files each containing the number of records you specify. Here is the source code for the tool.

What is the vshost.exe file?

If you have  been working in Visual Studio 2005 or later, you sure would come across a file  with the extension .vshost.exe.  You should find this file under the bin folder or the debug folder of your application.

What is the difference between Bool and Boolean in C#?

Posted in

We find both bool and Boolean types in C#. It just made me wonder if there is any difference between the two types. It appears there is no difference between the two as both Represent the Boolean Type. So bool is just an alias to the System.Boolean type.

 

Why am I not able to Move to the Begin of Stream using the Seek() Method in StreamReader?

Posted in

As you use StreamReader to manipulate Text files and read one line at a time using Readline() Method you might come across a situation where you are somewhere in the middle of the Stream say on the 5th line and want to go back to the begin of the Stream. You can do that using the Seek Method on the BaseStream of the StreamReader as in this example.

C# Statements Syntax for Reference

Posted in

C# Statements Syntax Reference

Category

Syntax Example

How to get the list of files in a given directory using C#?

Posted in

If I need to get a list of files of a particular type or extension in a given directory, how can I get that list using C# code. Here is an example where the code looks for files in the current directory with .txt extension and writes the list to the console.

How to read the contents of a text file using StreamReader class in C#?

Posted in

Using StreamReader class in C# can be fun and very handy to do some important tasks. Here is an example which will help you to understand how to use the StreamReader to read through a text file and also write it to the console line by line.

How to read Text from multiple files and write it to a single file using StreamReader and StreamWriter in C#?

Posted in

Here is an example of using StreamReader and StreamWriter class in C# to Read a number of text files from the source location and writing the contents of all the text files into a single Final Large file.

How to get Line Count of a File using StreamReader in C#

Posted in

1.       How to get the Count of line Numbers in a file using StreamReader in C#
or
2.       How to get Line Count of a File using StreamReader in C#

Syndicate content