Interview Questions (.NET)
What’s the difference of using System.Text.StringBuilder over System.String?
Answer: System.String is immutable. System.StringBuilder was designed with the
purpose of having a mutable string where a variety of operations can be performed.
What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
Answer: The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements
into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element’s object, resulting in a different, yet identical object.
How can you sort the elements of the array in descending order?
Answer: By calling Sort () and then Reverse () methods.
What’s the .NET collection class that allows an element to be accessed using a unique key?