C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » File Operations »

One movement with IsolatedStorage class


Posted Date: 26 Oct 2009    Resource Type: Code Snippets    Category: File Operations
Author: Shunmuganathan MMember Level: Diamond    
Rating: 1 out of 5Points: 10



It Represents an isolated storage area containing files and directories
This class is used to create directory and access the files in the particular files ect..
In the following code I explained "how can we create the directory and files" and
"How can we access the files and directory" using IsolatedStorage class.


Name space part

using System;
using System.IO;
using System.IO.IsolatedStorage;



Coding part

using (IsolatedStorageFile MyIsolatedStorageFile = IsolatedStorageFile.GetUserStoreForAssembly()) {
MyIsolatedStorageFile.CreateDirectory("Nathan");

using (Stream MyStream = new IsolatedStorageFileStream("ExpDet.txt", FileMode.Create, MyIsolatedStorageFile)) {
StreamWriter MyStreamWriter = new StreamWriter(MyStream);
MyStreamWriter.WriteLine("Nathan Soft Ware Engineer");
MyStreamWriter.Flush();
}

Console.WriteLine(MyIsolatedStorageFile.CurrentSize.ToString());
Console.WriteLine(MyIsolatedStorageFile.Scope.ToString());

string[] MyFiles = MyIsolatedStorageFile.GetFileNames("*.*");
foreach (string Myfile in Myfiles) {
Console.WriteLine(Myfile);
}
}


Code Explanation

1. Create the instance of the IsolatedStorage.
2. Create the directory using IsolatedStorage
3. Create the file in the created folder
4. Get the current size and scope using IsolatedStorage
5. Get all the files from the created folder

By
Nathan



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
My IsolatedStorage class  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Images From the Database
Previous Resource: Calculating the no. of lines in a file
Return to Discussion Resource Index
Post New Resource
Category: File Operations


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use