IO

Get IO, File Stream, Serialization, etc. Related Examples with code from here.

Process or Read the Content of an Atom or RSS Feed with C# Examples and VB.Net Examples

You can process the content of an Atom 1.0 or RSS 2.0 feed to extract or get details of the feed. .Net framework provide classes to parse the feed data. We are using System.ServiceModel.Syndication.SyndicationFeedFormatter and System.ServiceModel.Syndication.SyndicationFeed classes. Read More...

Tuesday, 11 September 2012

Binary Deserialization with C# Examples and VB.Net Examples

Binary Deserialization is a reverse process of Binary Serialization. In Binary Deserialization we fetch binary file that generated from Binary Serialization and get back orignal object. Read More...

Monday, 10 September 2012

Serialize object and store in file using Binary Serialization with C# Examples and VB.Net Examples

There is a need to serialize object and store into a file, and then deserialize when required. For Binary Serialization we are using "BinaryFormatter" class which is available in "System.Runtime.Serialization.Formatters.Binary" namespace. Read More...

Monday, 3 September 2012

Get or Retrieve stored file from SQL Server Database Table with C# Examples and VB.Net Examples

You can retrieve stored file from SQL Server Database Table and store as physical file in hard drive.Here is example for this. In this example we retrieved stored file from database record and store as physical file in hard drive. Read More...

Thursday, 30 August 2012

XML Deserialization with C# Examples and VB.Net Examples

In XML Deserialization you convert XML file data back in to custom class objects. This is a reverse process of XML Serialization. In previous example we serialize on object data in to XML now we take this Generated XML file and create class object from that. Read More...

Wednesday, 29 August 2012

XML Serialization of Class Objects with C# Examples and VB.Net Examples

There is a need where you want objects data into XML format. You can achieve this using XML Serialization. Using XML Serialization you can convert custom objects data into XML and XML into custom objects. We are using "XmlSerializer" class available in "System.Xml.Serialization" namespace. Read More...

Tuesday, 28 August 2012

Insert or Save file into SQL Server Database Table with C# Examples and VB.Net Examples

There is a need in application to upload a file and store into SQL Server Database table. You can do this very simple way. File is stored in sql server as binary data. You need to set "varbinary" data type of the column in which you want to store file. You need to take "varbinary(MAX)" data type. Read More...

Friday, 27 July 2012

Get list of all files of directory or folder using LINQ using .Net Framework 4 with C# Examples and VB.Net Examples

You can get list of all files in particular directory or folder and it's all sub directories. .NET Framework 4 allow to enumerate directories and files using methods that returns enumerable collections. There is a also a methods of get enumerable collections for DirectoryInfo , FileSystemInfo and FileInfo objects. Read More...

Monday, 23 July 2012

Copy one stream to another stream Using CopyTo Method with C# Examples and VB.Net Examples

.NET Framework 4 introduce new "CopyTo" method of Stream Class of System.IO namespace. Using this method we can copy one stream to another stream of different stream class. You can also say that write content or data of one stream to another stream. Read More...

Friday, 13 July 2012

Check file contents is changed using calculate and comparing hash code of a file using C# Examples and VB.Net Examples

Hash code of a file is useful for check that file contents is changed over the time or not. First time you calculate hash code of a file and store , after some time period you again calculate hash code of a file and compare with stored hash code, If hash code is changed that means contents of the file is changed. Read More...

Tuesday, 19 June 2012

How to Open a filestream for reading a stream using C# .Net Programming and VB.Net Programming

You can open a file in read mode and get FileStream Object for reading a stream. After getting FileStream object you can read data using "Read" and "ReadByte" methods. You can open any file ie Text , Image , doc etc.. After reading the file you need to close the FileStream Object. Read More...

Tuesday, 19 June 2012

Read file with FileStream using Read method in C# .Net Programming and VB.Net Programming

You can read file byte data using "Read" Method of FileStream class and get bytes array. You can also say that read bytes array from FileStream object or read bytes array from FILE. Here are example of this. Read More...

Saturday, 16 June 2012

Read the whole file and return a string of data using C# and VB.Net

There is a very quick way in .Net to read the entire file and return a string of data. We are using ReadAllText method of File class. Here are sample example of this. In this example we read the whole file in one statement and return it's string of data. These examples are in both C# and VB.Net . Read More...

Thursday, 14 June 2012

Append or Write the data to a text file

There is a very quick way to open text file and appends data into that file. There are two methods to appends text files AppendAllText and AppendAllLines. These methods open a file. Appends data to the files , and then close the file. If file does not exist, These methods create the files , appends the data and close the file. Read More...

Wednesday, 13 June 2012

Compress and Decompress file or data using C# and VB.Net

.Net framework provide the System.IO.Compression.GZipStream or System.IO.Compression.DeflateStream to compress or decompress data. Both GZipStream and DeflateStream classes allow you to use GZIP and Deflate compression algorithms to compress or decompress data. Read More...

Tuesday, 12 June 2012

Locate specific lines within the Text file Using LINQ

You can also query the text file using LINQ . Here are example for this. In this example we can get specific lines which has matching word given by us. After the LINQ query is executed you need to close file otherwise it gives error on next attempt to access of file. Read More...

Monday, 11 June 2012

How to Open a file and return a StreamReader for reading the data

You are able to get stream reader of a file and work on stream reader. After getting Stream Reader and completing work on stream reader you have to close SteramReader using Close method. to avoid any file open errors. Here are example for this. Read More...

Friday, 8 June 2012

How to Open a file and return a FileStream

You can get the FileStream of a file by opening a file using File Class. After get FileStream and completing work on file stream you have to close FileSteram using Close method. to avoid any file open errors. Here are example for this. Read More...

Tuesday, 15 May 2012

C# Programming : Upload file on FTP server using c#

You are able to upload a file on FTP server from your application. Using FtpWebRequest and FtpWebResponse classes executing File Transfer Protocol (FTP) commands from your Web page easy. In this example we are using System.Net and System.IO namespaces. Here is exmple for how to upload file on FTP server. Read More...

Monday, 14 May 2012

C# Programming : Download file from FTP server and save using c#

You are able to download file from FTP server and save to your desire location using .Net Using FtpWebRequest and FtpWebResponse classes executing File Transfer Protocol (FTP) commands from your Web page easy. Using these classes, implementing an entire FTP client right from your Web application is now possible. In this example we are using System.Net and System.IO namespaces. Read More...

Friday, 11 May 2012

Post data to remote server or URL in C# Programming

There are situations where you want to post data to remote server and other external URL. We can do this using System.Net namespace. In this sample example we have this "http://www.dummydomain.com/pagename.aspx" URL and we want to post query string data like "pageid=1&search=.net" and capture response of this in our code. We are using HttpWebRequest and HttpWebResponse class for this. Read More...

Thursday, 10 May 2012

Simple Screen Scrap using c# and vb.net

Screen scrapping means to get other sites data from given URL. You can do this using the HttpWebRequest and HttpWebResponse classes to screen scrape, you can use the following code to build a Web page that will serve as a simple Web browser. You also learn how to display another Web page inside of yours using an HttpWebRequest. Read More...

Wednesday, 9 May 2012

Reading contents of a MemoryMappedFile

.NET Framework includes the System.IO.MemoryMappedFiles namespace, which includes a number of classes that allow you to create memory-mapped files. Memory-mapped files can be useful when you encounter the limitations of the stream objects. Read More...

Friday, 4 May 2012

Beginning .Net : IO Readers and Writers in .Net

Main parts of I/O in the .NET Framework are Reader and Writer classes. These classes help the reading and writing of individual bytes to and from Streams. The .NET Framework provides a wide variety of reader and writer classes, each designed for reading or writing according to a specific set of rules. Read More...

Saturday, 28 April 2012

Reading and writing binary data in C# Programming

Now use the BinaryReader and BinaryWriter classes to read and write primitive types to a file.The BinaryWriter writes primitive objects in their native format, so in order to read them using the BinaryReader, you must select the appropriate Read method. Read More...

Friday, 27 April 2012

Reading and writing a text file with a StreamReader in C# Programming

StreamReader and StreamWriter classes to write a string to a text file and then read the contents of that text file. Here are Exmaple for Write and Read File. Read More...

Thursday, 26 April 2012

Write To a MemoryStream in C# Programming

There is a situation where you want to write data in Memory Stream. You can write to the stream by encoding a string containing the information you want to write to a byte array and then using the stream’s Write method to write the byte array to the MemoryStreams. Read More...

Wednesday, 25 April 2012

Beginning .Net : FileStream in .Net

Any type of I/O operation you are performing in .NET, if you want to read or write data you eventually use a stream of some type. Streams are the basic mechanism. .NET uses to transfer data to and from its underlying source, it will be a file, communication pipe, or TCP/IP socket. Read More...

Tuesday, 24 April 2012

Read a file using FileStream in C# Programming

There are many times you want to read text file. There are many ways to read files. One way is to use FileStream class. Here are sample example to read the file and display it's content on page. Read More...

Monday, 23 April 2012

Removing Rules to Access Control List on File and Directory using C# Programming

To remove rule you can use RemoveAccessRule methods. Here are sample Example. Read More...

Saturday, 21 April 2012

Adding a Rules to Access Control List on File and Directory using C# Programming

There is a situations where you want to modify the ACL lists. In this example, you give a specific user explicit Full Control rights over the file. You can use either an existing user or create a new test User account . Read More...

Thursday, 19 April 2012

Get Access Control List of File and Directory using C# Programming

There is a need to get the Access Control Lists or ACLs on directories and files. ACLs are the way resources such as directories and files are secured in the NTFS file system,which is the file system used by most recent versions of Windows. Manually you can view a file’s ACLs by selecting the Security tab from the file’s Properties dialog. Read More...

Wednesday, 18 April 2012

Beginning .Net : Working with Path Class using C# Programming

.NET Framework provides you with a class for working with file paths. The System .IO.Path class has many static methods to work with paths. Some static methods are... Read More...

Tuesday, 17 April 2012

Beginning .Net : Set and Get current directory in .Net

When an ASP.NET page is executed, the thread used to execute the code that generates the page by default has a current working directory of that page. It uses this directory as its base directory . If you pass a relative filename into any System.IO class, the file is assumed to be located relative to the current working directory. Read More...

Monday, 16 April 2012

Beginning .Net : Get list of files from directory programmatically using .Net

Sometimes we want list of files and its details like file name , size , last access time etc... of a directory programmatically. We can achieve this using DirectoryInfo and FileInfo Class. These classes are available in available in System.IO Namespace. Read More...

Thursday, 12 April 2012

Beginning .Net : Get Directory Information programmatically using .Net

Some time you want to get directory information like sub directories , last access time , last write time , Create new directory in to parent directory etc... programmatically using .Net. Read More...

Wednesday, 4 April 2012

Beginning.Net : Get System Drive info programmatically using .Net

You can get Drive info using DriveInfo class. DriveInfo class available in System.IO Namespace. You can get details like name, type, size, and status etc... of each drive. Read More...

No comments:

Post a Comment