Quality is delighting customers
Let suppose we need to retrieve the multiple output from a function, Then we can use "array" or "dictionary object" instead of variable.
The main Differences between Array and dictionary Object are ....
1.Array can hold same type data where as dictionary object can hold multiple types of data.
2.dictionary object size can dynamically expandable without any external action where as in case of arrays we need to use "redim" keyword externally to extend the size of the array.
There is one more way to look at dictionary object.
Array is used when the position and the element in the array is fixed. These are basically static.
But consider a scenario where application is generating some value dynamically...values are known but when it is appearing on the screen is unknown(consider this as a business logic)....and based on that value next course of action needs to be done.
To implement this method we might write n numbers of if conditions or else we can simply write a dictionary object. what ever value the application will generate we will send that to dictionary object,it will return the corresponding output for that value.
Now add suresh's two points....So instead of if you can use this as a container for any kind of object. And Dynamic expansion and removal is possible for Dictionary object.
So the bottom line is ...it is giving you more flexibility while coding.
Example. 1 .
Say in a registration page if you put First Name..Depending on business logic it might ask the following
value---Link Action Click
Value---Textbox Action SetText
value --radio Action Select one
but you don't know the order.
So your programming approach will be to insert all possible cases to dictionary object and Key with the output of the application.Say my application gave me an output as textbox...So input to the dictionary object will be textbox. It will automatically throw the output as Action as setText.
Boss Using Arrays we can hold any type of data.