difference between varchar and nvarchar

Nvarchar stores UNICODE data. If you have requirements to store UNICODE or multilingual data, nvarchar is the choice. Varchar stores ASCII data and should be your data type of choice for normal use.

What is the difference between Compile time Exception and Runtime Exception?

Compile time is where your compiler transforms your source code to a machine understandable language.
During the compile time, it processes through various stages:
Creation of Symbol table, Syntax analysis, Semantic analysis, Code optimization, Code Generation & Error Handling.
Runtime is during the execution process(Eg: Page request is made. or looping through a variable instances, etc). Runtime errors are handles after the successful compilation.

Best C# Practices to follow

  1. Always name things well.
  2. Make sure there is only one class per file.
  3. Always try to use properties instead of public variables.
  4. Write methods to make only one thing.
  5. Use public modifier only when necessary.
  6. Try to keep everything simple.
  7. Always be consistent.
  8. Use curly braces for if statement.
  9. Concatenate strings using “$”.
  10. Avoid global variables.(Make use of app.config file to declare global variables if needed).

Tell about static and instance class members?

  • When a class member includes a static modifier,the member is called as static member.When no static modifier is present the member is called non-static or instance member.
  • Static members are invoked using class name where as instance members are invoked using instances(objects) of the class.
  • An instance member belongs to specific instance(object) of a class.If we create three objects of a class we have three sets of instance members in the memory, where as there will ever be only one copy of the static member,no matter how many instances of a class are created.

What is a Object?

An object is an entity that has Properties for identifying State, Methods for behavior, Events for depicting the change of State.

Data associated at any given instance of time is the state of an object.

Every object differs from other objects either by state or behavior.