Monday, 16 December 2013
Thursday, 12 December 2013
Tuesday, 12 November 2013
Wednesday, 30 October 2013
Tuesday, 29 October 2013
Monday, 28 October 2013
Write a program to read a list of words, sort the words in alphabetical order and display them one word per line. Also give the total number of words in the list
.Suppose in a scenario if we want to display information only until 5.00 p.m and after that means after 5.00 p.m if any one tries to access the information it should give error message. Then how will you write a event for this ?
Wednesday, 16 October 2013
Tuesday, 15 October 2013
Friday, 11 October 2013
How to copy a file in C# .Net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
// copy a file
int a = 0;
try
{
if (a == 0)
{
File.Copy(path, "hell.txt" );
a++;
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
if (a > 0)
{
Console.WriteLine("file copied");
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
// copy a file
int a = 0;
try
{
if (a == 0)
{
File.Copy(path, "hell.txt" );
a++;
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
if (a > 0)
{
Console.WriteLine("file copied");
}
}
}
}
How to read a file in C# .Net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
StreamReader r = new StreamReader(path);
string s = r.ReadToEnd();
foreach (var item in s)
{
Console.Write(item);
}
// 2nd Way to read a file
string str ="";
while ((str = r.ReadLine())!=null)
{
Console.WriteLine(str);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
StreamReader r = new StreamReader(path);
string s = r.ReadToEnd();
foreach (var item in s)
{
Console.Write(item);
}
// 2nd Way to read a file
string str ="";
while ((str = r.ReadLine())!=null)
{
Console.WriteLine(str);
}
}
}
}
How to Append a file in C#.Net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
if (!File.Exists(path))
{
StreamWriter sw = new StreamWriter(path);
sw.WriteLine("hello");
sw.Close();
}
else
{
StreamWriter swr = new StreamWriter(path, true);
swr.WriteLine("heheehheehe");
swr.WriteLine("lallalaalal");
swr.Close();
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
if (!File.Exists(path))
{
StreamWriter sw = new StreamWriter(path);
sw.WriteLine("hello");
sw.Close();
}
else
{
StreamWriter swr = new StreamWriter(path, true);
swr.WriteLine("heheehheehe");
swr.WriteLine("lallalaalal");
swr.Close();
}
}
}
}
How to create a file in C# .Net
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
if (!File.Exists(path))
{
StreamWriter sw = new StreamWriter(path);
sw.WriteLine("hello");
sw.Close();
}
}
}
}
using System.Linq;
using System.Text;
using System.IO;
namespace file
{
class Program
{
static void Main(string[] args)
{
string path = "my_text.txt";
if (!File.Exists(path))
{
StreamWriter sw = new StreamWriter(path);
sw.WriteLine("hello");
sw.Close();
}
}
}
}