locked
ListDataSource, difference between index and key? RRS feed

  • Question

  • Hi,

    what is the difference between the index and the key in a ListDataSource?

    In the Custome Data Source Sample program, the 'key' is used to swap, deleter, remove elements of the data source, instead of the index, why?

    Thursday, December 8, 2011 7:59 PM

Answers

  • Hi Mesarina,

    A key is used to uniquely identify the item in the data source.  It would not change, even if the item was moved to a different location in the list.  The index would indicate the location of the object in the list.

    This talk actually explains the concept quite well: http://channel9.msdn.com/events/BUILD/BUILD2011/APP-210T  He talks about keys and index early in the talk.

    -Jeff


    Jeff Sanders (MSFT)
    Thursday, December 8, 2011 8:48 PM
    Moderator