Answered Questions

  • Default Access Specifer

    What is default access specifer of a class in C#? Is it internal or private?class foo{ int Var; }In the above code snippet. What is the default access specifier for the variable Var.

    Star Read Best Answer

    Editorial / Best Answer


    • Member Since Jul-2010 | Jul 16th, 2010

    Default Access Specifier of a class is Internal and Default Access Specifier of Member Variable is Private

  • Authentication Levels

    How we can set Different levels of Authentication in .Net?What are the difference between Windows Authenticatin, Passport Authentication and Form Authentication?

    Star Read Best Answer

    Editorial / Best Answer


    • Member Since Apr-2009 | Apr 30th, 2009

    Windows authentication enables you to identify users without creating a custom page. Credentials are stored in the Web server’s local user database or an Active Directory domain. Once identified, you can use the user’s credentials to gain access to resources that are protected by Windows authorization.

    Forms authentication enables you to identify users with a custom database, such as an ASP.NET membership database. Alternatively, you can implement your own custom database. Once authenticated, you can reference the roles the user is in to restrict access to portions of your Web site.

    Passport authentication relies on a centralized service provided by Microsoft. Passport authentication identifies a user with using his or her e-mail address and a password, and a single Passport account can be used with many different Web sites. Passport authentication is primarily used for public Web sites with thousands of users.

    Anonymous authentication does not require the user to provide credentials.


    • Jan 13th, 2011

    Windows Authentication Windows Authentication is the default authentication mechanism for ASP.NET applications. Windows Authentication is implemented in ASP.NET using the Windows authentication&n...

  • Virtual function in c#

    explain virtual function in c# with an example

    Star Read Best Answer

    Editorial / Best Answer


    • Member Since May-2008 | Jun 6th, 2008

    Virtual functions implement the concept of polymorphism are the same as in C#, except that you use the override keyword with the virtual function implementaion in the child class. The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.

    class Shape
    public virtual void Draw()
    Console.WriteLine("Shape.Draw") ;

    class Rectangle : Shape

    public override void Draw()

  • What are public, private and static constructors and differences between them?

  • Is it possible to have different access modifiers on the get/set methods of a property? Justify

    S Manasa

    • Jul 8th, 2019

    Generally, the access modifier of the property is considered as the access modifier of both the accessors if no access modifier is specified for the accessors. Only one of the accessor can be specifi...

  • What is the difference between const and static read-only?

    The difference is that static read-only can be modified by the containing class, but const can never be modified and must be initialized to a compile time constant. To expand on the static read-only case a bit, the containing class can only modify it:-- in the variable declaration (through a variable initializer).-- in the static constructor (instance constructors if it's not static).

    Star Read Best Answer

    Editorial / Best Answer

    Answered by: Eddie Quiroz

    • Sep 3rd, 2005

    A const must be initialized at the time of its creation. A readonly field can be assigned to once in the class constructor allowing you to pass in the value at run-time. Declaring fields as const protects both you and other programmers from accidentally changing the value of the field. Also note that with const fields, the compiler performs some optimization by not declaring any stack space for the field. The readonly keyword is similar to const, with two exceptions. First, the storage of a readonly field is the same as a regular read-write field, and thus there is no performance benefit. Secondly, readonly fields can be initialized in the constructor of the containing class.


    • Apr 7th, 2009

    As static read-only variables must be initialized in the static constructor (static constructor cannot have parameters and it cannot be called manually), it is efficient to used const variables over static read-only variables if you know the values at creation of these variables.