Background Image

Some helpful c# interview questions

by Preeti Modanwal on 17 January, 2018

1) What is difference between String and Convert.tostring?

The basic difference between them is “Convert” function handles NULL Value while “i.ToString()” does not support. It will throw a NULL reference exception error.

2)What is difference between string and string builder reference type?

System.string provides a set of members to work with text. System.string are immutable(that means data value may not be changed or can not change string ).
System.stringbuilder is used for dynamic strings which are mutable (that means string value can be changed dynamically). These string classes also overrides operators from System.object.

3)What is encapsulation?

Encapsulation means packaging of data. It is protective wrapper which prevents the data from being accessed by the code outside the wrapper, the code inside the wrapper can be accessed by a well defined interface.

eg-class is a protective wrapper which binds data and methods together,they can be accessed only through well defined interface(i.e object of that class)