Question Paper of UNIT-IV
Question Paper of UNIT-IV
Question Paper of UNIT-IV
b) The "ReadAllLines" method reads all the contents of a file and stores each line at a new
index in an array of string type.
string filePath = @"C:\MyData\TestFile.txt";
string[] testDataLineByLine = File.ReadAllLines(filePath);
OUTPUT:
Q6. What is Binary writer class? Describe with example.
Ans:
The BinaryWriter class provides methods that simplify writing primitive data types to a stream.
For example, you can use the Write method to write a Boolean value to the stream as a one-byte
value. The class includes write methods that support different data types.
To use .NET remoting to build an application in which two components communicate directly
across an application domain boundary, the following components are required:
1. using System;
2. using System.Data.SqlClient;
3. namespace AdoNetConsoleApplication
4. {
5. class Program
6. {
7. static void Main(string[] args)
8. {
9. new Program().Connecting();
10. }
11. public void Connecting()
12. {
13. using (
14. // Creating Connection
15. SqlConnection con = new SqlConnection("data source=.; database=student; in
tegrated security=SSPI")
16. )
17. {
18. con.Open();
19. Console.WriteLine("Connection Established Successfully");
20. }
21. } } }