Home
C-Sharp
Interview FAQs

Show

FAQs of level

  1. A primary interop assembly contains type definitions (as metadata) of types implemented with COM.
  2. Only a single PIA can exist, which needs to be signed with a strong name by the publisher of the COM type library.
  3. One PIA can wrap multiple versions of the same type library.
  4. A COM type library imported as an assembly can be a PIA only if it has been signed and published by the same publisher.

Therefore, only the publisher of a type library can produce a true PIA, that can be considered as the unit of an official type definition for interoperating with the underlying COM types.

The is operator checks whether an object is compatible with a given type, and the result of the evaluation is a Boolean: true or false. The is operator will never throw an exception. An is expression evaluates to true if both of the following conditions are met: 

  • expression can be cast to type
  • expression is not null
The as operator is like a cast except that it yields null on conversion failure instead of raising an exception. More formally, an expression of the form:
Employee e = obj as Employee;
is equivalent to:
Employee e = obj is Employee ? (Employee)obj : (Employee)null;

Properties can be made read-only by having only a get accessor in the implementation.

public class X
{
   public X(int id)
   {
       x_id = id;
   }
   public int ID
   {
       get
       {
           return x_id;
       }
   }
}

The read only can be modified by the class it is contained in. However, the const cannot be modified. It needs to be instantiated only at the compile time.

  • The request for the creation of an object is served by allocating an object from the pool.
  • This reduces the overhead of creating and re-creating objects each time an object creation is required.

To enhance performance and reduce the load of creating new objects, instead re using existing objects stored in memory pool. Object Pool is a container of objects that are for use and have already been created. Whenever an object creation request occurs, the pool manager serves the request by allocating an object from the pool. This minimizes the memory consumption and systems resources by recycling and re-using objects. When the task of an object is done, it is sent to the pool rather than being destroyed. This reduces the work for garbage collector and fewer memory allocations occur.

The use of GetCommandLineArgs() method is-

  • With GetCommandLineArgs() method, the command line arguments can be accessed.
  • The value returned is an array of strings.

UTF-8 uses variable byte to store a Unicode. In different code range, it has its own code length, varies from 1 byte to 6 bytes. Because it varies from 8 bits (1 byte), it is so called "UTF-8". UTF-8 is suitable for using on Internet, networks or some kind of applications that needs to use slow connection.
Unicode (or UCS) Transformation Format, 16-bit encoding form. The UTF-16 is the Unicode Transformation Format that serializes a Unicode scalar value (code point) as a sequence of two bytes, in either big-endian or little-endian format. Because it is grouped by 16-bits (2 bytes), it is also called "UTF-16", which is the most commonly used standard.

Here is the some c# sealed classes-

  • System.String
  • System.Data.SqlClient.SqlCommand
  • System.Data.SqlClient.SqlCommandBuilder
  • System.Data.SqlClient.SqlConnection
  • System.Data.SqlClient.SqlConnectionStringBuilder
  • System.Data.SqlClient.SqlDataAdapter
  • System.Diagnostics.Debug
  • System.Diagnostics.Trace
  • System.Web.HttpRequest
  • System.Web.HttpCookie
  • System.Web.HttpContext

Here is the some c# abstract classes

  • System.Data.Common.DbCommand
  • System.Data.Common.DbCommandBuilder
  • System.Data.Common.DbConnection
  • System.Data.Common.DbDataAdapter
  • System.Data.Common.DbDataReader
  • System.Xml.XmlNode
  • System.Xml.XmlNodeList
  • System.Xml.XmlReader
  • System.Net.WebRequest
  • System.Net.WebResponse

Here is the some c# interfaces-

  • System.Web.IHttpModule
  • System.Web.IHttpHandler
  • System.Data.IDataAdapter
  • System.Data.IDataParameter
  • System.Data.IDataReader
  • System.Data.IDbCommand
  • System.Data.IDbConnection
  • System.Data.IDbDataAdapter
  • System.Security.Principal.IPrincipal
  • System.Security.Principal.IIdentity

PreviousDisplaying 24 of 25Next
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*