Till now we have done with these controls using static values by manually entering using properties. Now we are moving one step forward and make these controls dynamic.
Here we got a new word “Data Binding”; let’s have a look at this in detail
Data Binding:
It is a process where we create “data object” and bound it to the “control object” for getting effective presentation.
Data Object:
It means an object which stores data inside it and mostly as group of elements. .Net provides many objects which can be used to prepare data objects. Some of the important namespaces where these classes are present are:
· System
· System.Collections
· System.Collections.Generic
· System.Data
and few more…
Q: what is a collection and is it preferred to use Collections in .Net?
A collection is one structure in .Net which is similar to an array but with lot of functionality and also with no limitations in storing the type of data in elements.
· System.Collections: It is one of the oldest namespace in .Net which provides collection classes. All classes in this are replaced in higher versions of .Net i.e., starting from v2.0. One main reason to change them is to avoid Boxing/Unboxing operations, which these all classes undergo.
Boxing and Unboxing:
If a value type is stored on managed heap as a reference type we call it as “Boxing”.
Int x = 100;
Object obj = x; //Boxing
If that reference type is again converted back into value type we call it as Unboxing. But here implicit conversion will not take place. We need to perform an explicit conversion.
Int y = (int) obj; //Unboxing
· System.Collections.Generic: It is the new namespace which is most used today in .Net and it is recommended to use this namespace instead of System.Collections.
Note: Working with List controls with Data Binding concept is the most preferred way of working with these controls than working with design time options.
----------------------------------------------------------
** If you like this post please like our page in
facebook " Dot Net Support" .
0 comments:
Post a Comment