Answered Questions

  • Public Members

    Why do we use properties rather than public members?

    Star Read Best Answer

    Editorial / Best Answer

    netdev  

    • Member Since Oct-2009 | Oct 10th, 2009


    To the user of an object, property and public member may not make much difference with respect to syntax. However, property provides the ability to combine both field and method via the get and set accessors.

    MS Help for C# presents the best answer for using properties:

    Properties have many uses: they can validate data before allowing a change; they can transparently expose data on a class where that data is actually retrieved from some other source, such as a database; they can take an action when data is changed, such as raising an event, or changing the value of other fields.

    ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/dv_csref/html/f7f67b05-0983-4cdb-96af-1855d24c967c.htm

    azita2005

    • Apr 1st, 2010

    With Properties, we can implement validation.For example, if we have customer age and we want to add validation on  the age, we can do it with properties.Another benefits of properties is that we can protect a field in a class by reading and writing it through the properties.

    SeeSharp

    • Mar 7th, 2010

    Private data fields of class should not be exposed by making them public. Instead they can made visible using public properties in more controlled manner. Also we can make properties read only or read/write.

  • AutoPostBack Property

    There is Cancel button and OK button on page. When we click Cancel button it skips all validation controls and goes to next page.(a)Page AutoPostback of Cancel is True.(b)Page AutoPostback of Cancel is False.(c)Page AutoPostback of OK is True.(d)Page AutoPostback of OK is False.Which option is correct?

    Star Read Best Answer

    Editorial / Best Answer

    solanki.hr  

    • Member Since Dec-2009 | Dec 10th, 2009


    A button control does not have AutoPostBack property it has click event. so once you click on cancel and if its CausesValidation Property is false it will skips all validations, and if it is true it will validate the controls on the page.

    AutoPostBack property is for say DropDown,textbox etc... whnever you change/enter value/keyed some caharcter in textbox or change your selection in drop down postback will happen if that control's is AutoPostBack property is true, depending on that postback you can fill values or set some values for other controls or you can do some validation against enterd or selcted values.

    e.g. say tehre are 2 drop down. DropDown1 and DropDown2
    DropDown2 is currently holding states of US country as in DropDown1 you have selcted US. Now you want to fill DropDown2 with state value of India.
    Now if
    DropDown1.AutopostBack = True;

    and you change DropDown1's value from Us to India. 
    Page will post back to server and you can fill DropDown2 with Indian States.

    Thanks,
    Solanki  

  • Explicit Implimentation

    What do you mean by Explicit Interface Implimentation? What's Interface Mapping?

  • C# Serializable Keyword

    What is the use of serializable keyword in C#?

    kirangiet

    • Jun 8th, 2010

    We usually serialize the object, which we are transferring across processes.Example: When we are using Out Proc session Management we should add the serializable attribute at the top of the class.e.g.[Serializable]public Class Employee{public string Name;public int Age;}

  • Postbackurl and Navigateurl

    What is difference between "Session" and "Session" Objects? What is the use of "postbackurl" and "navigateurl" and the differences between those two things?

  • Object Oriented and Object Based Language

    Explain What are Object Oriented Language and Object Based Language

    Star Read Best Answer

    Editorial / Best Answer

    Aarthy_SP  

    • Member Since Dec-2008 | Dec 10th, 2008


    Any langauge based on encapsulation concpet and operations with the objects are called as Object Based language. Exmaple : VB is a Object based and not an Object oriented

    Any langauge based on encapsulation concept and operations with the objects and also dealing with the inheritance and polymorphism are called as Object Oriented language. Exmaple : C++,C#

    Arpit Mandloi

    • Nov 25th, 2015

    Object Based languages: 1. Object-based language doesn't support all the features of OOPs like Polymorphism and Inheritance 2. Object-based language has in-built object like JavaScript has window obje...