MainMenu

Home Java Overview Maven Tutorials

Important C# Interview Questions and Answers

C# Interview Question and Answers


1 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



2 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



3 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



4 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



5 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



6 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



7 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



8 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



9 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



10 :-



11 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



12 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



13 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



14 :- What class is underneath the SortedList class?
A sorted HashTable



15 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



16 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



17 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



18 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



19 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



20 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



21 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



22 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



23 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



24 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



25 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



26 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



27 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



28 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



29 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



30 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



31 :-



32 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



33 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



34 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



35 :- What class is underneath the SortedList class?
A sorted HashTable



36 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



37 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



38 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



39 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



40 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



41 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



42 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



43 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



44 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



45 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



46 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



47 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



48 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



49 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



50 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



51 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



52 :-



53 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



54 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



55 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



56 :- What class is underneath the SortedList class?
A sorted HashTable



57 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



58 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



59 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



60 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



61 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



62 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



63 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



64 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



65 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



66 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



67 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



68 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



69 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



70 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



71 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



72 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



73 :-



74 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



75 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



76 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



77 :- What class is underneath the SortedList class?
A sorted HashTable



78 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



79 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



80 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



81 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



82 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



83 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



84 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



85 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



86 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



87 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



88 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



89 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



90 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



91 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



92 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



93 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



94 :-



95 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



96 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



97 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



98 :- What class is underneath the SortedList class?
A sorted HashTable



99 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



100 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



101 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



102 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



103 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



104 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



105 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



106 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



107 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



108 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



109 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



110 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



111 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



112 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



113 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



114 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



115 :-



116 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



117 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



118 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



119 :- What class is underneath the SortedList class?
A sorted HashTable



120 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



121 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



122 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



123 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



124 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



125 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



126 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



127 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



128 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



129 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



130 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



131 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



132 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



133 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



134 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



135 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



136 :-



137 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



138 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



139 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



140 :- What class is underneath the SortedList class?
A sorted HashTable



141 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



142 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



143 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



144 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



145 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



146 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



147 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



148 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



149 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



150 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



151 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



152 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



153 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



154 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



155 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



156 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



157 :-



158 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



159 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



160 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



161 :- What class is underneath the SortedList class?
A sorted HashTable



162 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



163 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



164 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



165 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



166 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



167 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



168 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



169 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



170 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



171 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



172 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



173 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



174 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



175 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



176 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



177 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



178 :-



179 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



180 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



181 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



182 :- What class is underneath the SortedList class?
A sorted HashTable



183 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



184 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



185 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



186 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



187 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



188 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



189 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



190 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



191 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



192 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



193 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



194 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



195 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



196 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



197 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



198 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



199 :-



200 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



201 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



202 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



203 :- What class is underneath the SortedList class?
A sorted HashTable



204 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



205 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



206 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



207 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



208 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



209 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



210 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



211 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



212 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



213 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



214 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



215 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



216 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



217 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



218 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



219 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



220 :-



221 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



222 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



223 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



224 :- What class is underneath the SortedList class?
A sorted HashTable



225 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



226 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



227 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



228 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



229 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



230 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



231 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



232 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



233 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



234 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



235 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



236 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



237 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



238 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



239 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



240 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



241 :-



242 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



243 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



244 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



245 :- What class is underneath the SortedList class?
A sorted HashTable



246 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



247 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



248 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



249 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



250 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



251 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



252 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



253 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



254 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



255 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



256 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



257 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



258 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



259 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



260 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



261 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



262 :-



263 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



264 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



265 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



266 :- What class is underneath the SortedList class?
A sorted HashTable



267 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



268 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



269 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



270 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



271 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



272 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



273 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



274 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



275 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



276 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



277 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



278 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



279 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



280 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



281 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



282 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



283 :-



284 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



285 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



286 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



287 :- What class is underneath the SortedList class?
A sorted HashTable



288 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



289 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



290 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



291 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



292 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



293 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



294 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



295 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



296 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



297 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



298 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



299 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



300 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



301 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



302 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



303 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



304 :-



305 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



306 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



307 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



308 :- What class is underneath the SortedList class?
A sorted HashTable



309 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



310 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



311 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



312 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



313 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



314 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



315 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



316 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



317 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



318 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



319 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



320 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



321 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



322 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



323 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



324 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



325 :-



326 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



327 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



328 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



329 :- What class is underneath the SortedList class?
A sorted HashTable



330 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



331 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



332 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



333 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



334 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



335 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



336 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



337 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



338 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



339 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



340 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



341 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



342 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



343 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



344 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



345 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



346 :-



347 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



348 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



349 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



350 :- What class is underneath the SortedList class?
A sorted HashTable



351 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



352 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



353 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



354 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



355 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



356 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



357 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



358 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



359 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



360 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



361 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



362 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



363 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



364 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



365 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



366 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



367 :-



368 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



369 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



370 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



371 :- What class is underneath the SortedList class?
A sorted HashTable



372 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



373 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



374 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



375 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



376 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



377 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



378 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



379 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



380 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



381 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



382 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



383 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



384 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



385 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



386 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



387 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



388 :-



389 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



390 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



391 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



392 :- What class is underneath the SortedList class?
A sorted HashTable



393 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



394 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



395 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



396 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



397 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



398 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



399 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



400 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



401 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



402 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



403 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



404 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



405 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



406 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



407 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



408 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



409 :-



410 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



411 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



412 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



413 :- What class is underneath the SortedList class?
A sorted HashTable



414 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



415 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



416 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



417 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



418 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



419 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



420 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



421 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



422 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



423 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



424 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



425 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



426 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



427 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



428 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



429 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



430 :-



431 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



432 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



433 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



434 :- What class is underneath the SortedList class?
A sorted HashTable



435 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



436 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



437 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



438 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



439 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



440 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



441 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



442 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



443 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



444 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



445 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



446 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



447 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



448 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



449 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



450 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



451 :-



452 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



453 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



454 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



455 :- What class is underneath the SortedList class?
A sorted HashTable



456 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



457 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



458 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



459 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



460 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



461 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



462 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



463 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



464 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



465 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



466 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



467 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



468 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



469 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



470 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



471 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



472 :-



473 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



474 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



475 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



476 :- What class is underneath the SortedList class?
A sorted HashTable



477 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



478 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



479 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



480 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



481 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



482 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



483 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



484 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



485 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



486 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



487 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



488 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



489 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



490 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



491 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



492 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



493 :-



494 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



495 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



496 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



497 :- What class is underneath the SortedList class?
A sorted HashTable



498 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



499 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



500 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



501 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



502 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



503 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



504 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



505 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



506 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



507 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



508 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



509 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



510 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



511 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



512 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



513 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



514 :-



515 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



516 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



517 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



518 :- What class is underneath the SortedList class?
A sorted HashTable



519 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



520 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



521 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



522 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



523 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



524 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



525 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



526 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



527 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



528 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



529 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



530 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



531 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



532 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



533 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



534 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



535 :-



536 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



537 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



538 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



539 :- What class is underneath the SortedList class?
A sorted HashTable



540 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



541 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



542 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



543 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



544 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



545 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



546 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



547 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



548 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



549 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



550 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



551 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



552 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



553 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



554 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



555 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



556 :-



557 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



558 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



559 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



560 :- What class is underneath the SortedList class?
A sorted HashTable



561 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



562 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



563 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



564 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



565 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



566 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



567 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



568 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



569 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



570 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



571 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



572 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



573 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



574 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



575 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



576 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



577 :-



578 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



579 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



580 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



581 :- What class is underneath the SortedList class?
A sorted HashTable



582 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



583 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



584 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



585 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



586 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



587 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



588 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



589 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



590 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



591 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



592 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



593 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



594 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



595 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



596 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



597 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



598 :-



599 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



600 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



601 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



602 :- What class is underneath the SortedList class?
A sorted HashTable



603 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



604 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



605 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



606 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



607 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



608 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



609 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



610 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



611 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



612 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



613 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



614 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



615 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



616 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



617 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



618 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



619 :-



620 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



621 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



622 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



623 :- What class is underneath the SortedList class?
A sorted HashTable



624 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



625 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



626 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



627 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



628 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



629 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



630 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



631 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



632 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



633 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



634 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



635 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



636 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



637 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



638 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



639 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



640 :-



641 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



642 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



643 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



644 :- What class is underneath the SortedList class?
A sorted HashTable



645 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



646 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



647 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



648 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



649 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



650 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



651 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



652 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



653 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



654 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



655 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



656 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



657 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



658 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



659 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



660 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



661 :-



662 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



663 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



664 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



665 :- What class is underneath the SortedList class?
A sorted HashTable



666 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



667 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



668 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



669 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



670 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



671 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



672 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



673 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



674 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



675 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



676 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



677 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



678 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



679 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



680 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



681 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



682 :-



683 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



684 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



685 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



686 :- What class is underneath the SortedList class?
A sorted HashTable



687 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



688 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



689 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



690 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



691 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



692 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



693 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



694 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



695 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



696 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



697 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



698 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



699 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



700 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



701 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



702 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



703 :-



704 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



705 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



706 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



707 :- What class is underneath the SortedList class?
A sorted HashTable



708 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



709 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



710 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



711 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



712 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



713 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



714 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



715 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



716 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



717 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



718 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



719 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



720 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



721 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



722 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



723 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



724 :-



725 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



726 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



727 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



728 :- What class is underneath the SortedList class?
A sorted HashTable



729 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



730 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



731 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



732 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



733 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



734 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



735 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



736 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



737 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



738 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



739 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



740 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



741 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



742 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



743 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



744 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



745 :-



746 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



747 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



748 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



749 :- What class is underneath the SortedList class?
A sorted HashTable



750 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



751 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



752 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



753 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



754 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



755 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



756 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



757 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



758 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



759 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



760 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



761 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



762 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



763 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



764 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



765 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



766 :-



767 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



768 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



769 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



770 :- What class is underneath the SortedList class?
A sorted HashTable



771 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



772 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



773 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



774 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



775 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



776 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



777 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



778 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



779 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



780 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



781 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



782 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



783 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



784 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



785 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



786 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



787 :-



788 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



789 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



790 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



791 :- What class is underneath the SortedList class?
A sorted HashTable



792 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



793 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



794 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



795 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



796 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



797 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



798 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



799 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



800 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



801 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



802 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



803 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



804 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



805 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



806 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



807 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



808 :-



809 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



810 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



811 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



812 :- What class is underneath the SortedList class?
A sorted HashTable



813 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



814 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



815 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



816 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



817 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



818 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



819 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



820 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



821 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



822 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



823 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



824 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



825 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



826 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



827 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



828 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



829 :-



830 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



831 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



832 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



833 :- What class is underneath the SortedList class?
A sorted HashTable



834 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



835 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



836 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



837 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



838 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



839 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



840 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



841 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



842 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



843 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



844 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



845 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



846 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



847 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



848 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



849 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



850 :-



851 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



852 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



853 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



854 :- What class is underneath the SortedList class?
A sorted HashTable



855 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



856 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



857 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



858 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



859 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



860 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



861 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



862 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



863 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



864 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



865 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



866 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



867 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



868 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



869 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



870 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



871 :-



872 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



873 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



874 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



875 :- What class is underneath the SortedList class?
A sorted HashTable



876 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



877 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



878 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



879 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



880 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



881 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



882 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



883 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



884 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



885 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



886 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



887 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



888 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



889 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



890 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



891 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



892 :-



893 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



894 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



895 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



896 :- What class is underneath the SortedList class?
A sorted HashTable



897 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



898 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



899 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



900 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



901 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



902 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



903 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



904 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



905 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



906 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



907 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



908 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



909 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



910 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



911 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



912 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



913 :-



914 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



915 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



916 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



917 :- What class is underneath the SortedList class?
A sorted HashTable



918 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



919 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



920 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



921 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



922 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



923 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



924 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



925 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



926 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



927 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



928 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



929 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



930 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



931 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



932 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



933 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



934 :-



935 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



936 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



937 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



938 :- What class is underneath the SortedList class?
A sorted HashTable



939 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



940 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



941 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



942 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



943 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



944 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



945 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



946 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



947 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



948 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



949 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



950 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



951 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



952 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



953 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



954 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



955 :-



956 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



957 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



958 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



959 :- What class is underneath the SortedList class?
A sorted HashTable



960 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



961 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



962 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



963 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



964 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



965 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



966 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



967 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



968 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



969 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



970 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



971 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



972 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



973 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



974 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



975 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



976 :-



977 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



978 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



979 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



980 :- What class is underneath the SortedList class?
A sorted HashTable



981 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



982 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



983 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



984 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



985 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



986 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



987 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));



988 :- Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.



989 :- Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.



990 :- What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.



991 :- What is the use of CommandBehavior.CloseConnection?
We can use pass it with ExecuteReader method of Command object like reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); This will make sure that when we are calling reader.Close() the associated connection object will also be closed.



992 :- How to declare a property in a class?
int m_PersonID = 0; public int PersonID { get { return m_PersonID; } set { m_PersonID = value; } }



993 :- How to declare a property in an Interface?
DateTime DateOfBirth { get;set;} int Age { get;set;} string FirstName { get;set;} As this is an Interface, so no implementation required only definition of properties are required. Implementation of these properties will be written into the class inherting this interface.



994 :- How to declare methods into an Interface void Calculate(); int Insert(string firstName, string lastName, int age); Interface doesn't contain implementation so methods implementation will be written into class inherting this interface.



995 :- How to load assembly from GAC?
Lets say you have to load the assembly from GAC on button click event then you should write following method. protected void btn_Click(object sender, EventArgs e) { AssemblyName asm = new AssemblyName("ClassLibrary1, Version=1.1.0.0, Culture=neutral, PublicKeyToken=fbc28d9ca2fc8db5"); Assembly al = Assembly.Load(asm); Type t = al.GetType("ClassLibrary1.Class1"); MethodInfo m = t.GetMethod("Method1"); str = "reflection - " + (string)m.Invoke(null, null); MessageBox.Show(str); } For more visit http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html



996 :- Difference Between dispose and finalize method?
Dispose is a method for realse from the memory for an object. For eg: .Dispose. Finalize is used to fire when the object is going to realize the memory.We can set a alert message to says that this object is going to dispose.



997 :-



998 :- What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.



999 :- What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.



1000 :- Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.



1001 :- What class is underneath the SortedList class?
A sorted HashTable



1002 :- What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay. To Do: Investigate



1003 :- Types of Errors ?
Configuration Errors Parser Errors Compilation Errors Run-Time Errors



1004 :- Difference between classes and structures?
A struct is a value type and a class is a reference type. When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack. Classes can have explicit parameter less constructors. But structs dosn't have this. Classes support inheritance. No inheritance for structs. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.



1005 :- How to convert a sentence into Title Case (Capitalize first character of every word)?
Use ToTitleCase method. System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("dotnetfunda.com is a very good website"); The output will be "Dotnetfunda.Com Is A Very Good Website"



1006 :- How to sort an array into descending order?
First sort the array using Array.Sort and then use Array.Reverse Eg. int[] number = new int[] {6, 4, 7}; Array.Sort(number); // sort in ascending order foreach (int i in number) { lblMessage.Text += i + "
"; } // reverse ie descending order Array.Reverse(number); lblMessage.Text += "


"; foreach (int i in number) { lblMessage.Text += i + "
"; }



1007 :- How to read entire stream contents?
If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code. // here theStream is the stream object while (myStream.Position != myStream.Length) { Console.WriteLine("{0:x2}", myStream.ReadByte()); }



1008 :- Write a single line of code to read the entire content of the text file. User following code string strContent = System.IO.File.ReadAllText(Server.MapPath("~/MyTextFile.txt"));









No comments:

Post a Comment