StreamReader :-

 StreamReader :-

Prog

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.IO;

 

namespace progsreader

{

    class Program

    {

        static void Main(string[] args)

        {

            FileStream fs = new FileStream("C:\\my\\my1.txt",FileMode.OpenOrCreate);

            StreamReader sr = new StreamReader(fs);

            string msg = sr.ReadLine();

            Console.WriteLine(msg);

            Console.ReadLine();

 

 

 

        }

    }

}

TextWriter Object :- In this Object we can write any types of information in the files.

² Notes:- c # supports group code fundamentals.

Prog;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.IO;

 

namespace progtextwritetr

{

    class Program

    {

        static void Main(string[] args)

        {

            using (TextWriter tw = File.CreateText("C:\\my\\mynew.txt"))

            

            {

                tw.WriteLine("hello");

                tw.WriteLine("brother");

                tw.WriteLine("wow");

            }

            Console.WriteLine("FIle succes created");

 

            Console.ReadKey();

 

        }

    }

}

 

TextReader object:-

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.IO;

 

 

namespace progtextreader

{

    class Program

    {

        static void Main(string[] args)

        {

            using (TextReader t1 = File.OpenText("C:\\my\\mynew.txt"))

            {

                Console.WriteLine(t1.ReadToEnd());

            }

            Console.ReadKey();

        }

        

    }

}

TASK :- write a program to generate following result

Create a function-input()

Create a parameter -id,name,city,branch,m1,m2,m3,m4,m5.

Create a method display()

Logic 1 input all parameter by the user

2 check the following condition

a) Calculate total

b) If total is <250 - a grade.

c) If total is less

d) Otherwise fail

e) Create a file- student.txt

f) Display all information inside student file.

g) In following pattern

Result

h) Name -

i) City-

j) Branch-

k) Total-

l) Grade-

Developed by-Rahul 

Comments

Popular posts from this blog

ViewState for state management

Store procedure Data Base handling (procedure_insert).

Database joining