name value pair

Discussion in 'ASP .Net' started by Andy Sutorius via DotNetMonster.com, May 27, 2005.

  1. Andy Sutorius via DotNetMonster.com, May 27, 2005
    #1
    1. Advertising

  2. You can use a datatable which is to generic...

    But if both column's composition is unique, u can use hash table for fast
    access. For instance,

    Sample Data:
    A 1
    B 1
    C 2
    A 2
    B 3

    If u have data like this,

    u can use hash table
    either
    concatenating key value pairs with a special separator such as "$_$".
    and use this string as hash value
    or
    just use keys as keys and use an arraylist for the changing values
    A shows an arraylist containing 1,2
    B shows an arraylist containing 1, 3
    C should show aan arraylist containing 2

    Hope this helps,

    --

    Thanks,
    Yunus Emre ALPÖZEN
    BSc, MCSD.NET

    "Andy Sutorius via DotNetMonster.com" <> wrote
    in message news:...
    > Hi,
    >
    > What collection can I use to store name value pairs that contain
    > duplicates
    > in both columns?
    >
    > Thanks,
    >
    > Andy
    >
    > --
    > Message posted via DotNetMonster.com
    > http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1
     
    Yunus Emre ALPÖZEN [MCSD.NET], May 27, 2005
    #2
    1. Advertising

  3. I don't thinks you can add
    A 1
    B 1
    C 2
    A 2
    B 3

    to a Hashtable. Using Hashtable, key must be unique. In above data, it will
    throw ArgumentException: Item has already been used...

    Elton Wang

    "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:

    > You can use a datatable which is to generic...
    >
    > But if both column's composition is unique, u can use hash table for fast
    > access. For instance,
    >
    > Sample Data:
    > A 1
    > B 1
    > C 2
    > A 2
    > B 3
    >
    > If u have data like this,
    >
    > u can use hash table
    > either
    > concatenating key value pairs with a special separator such as "$_$".
    > and use this string as hash value
    > or
    > just use keys as keys and use an arraylist for the changing values
    > A shows an arraylist containing 1,2
    > B shows an arraylist containing 1, 3
    > C should show aan arraylist containing 2
    >
    > Hope this helps,
    >
    > --
    >
    > Thanks,
    > Yunus Emre ALPÖZEN
    > BSc, MCSD.NET
    >
    > "Andy Sutorius via DotNetMonster.com" <> wrote
    > in message news:...
    > > Hi,
    > >
    > > What collection can I use to store name value pairs that contain
    > > duplicates
    > > in both columns?
    > >
    > > Thanks,
    > >
    > > Andy
    > >
    > > --
    > > Message posted via DotNetMonster.com
    > > http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1

    >
    >
    >
     
    =?Utf-8?B?RWx0b24gVw==?=, May 28, 2005
    #3
  4. Just read my post again. I advised two solution two overcome this issue....

    --

    Thanks,
    Yunus Emre ALPÖZEN
    BSc, MCSD.NET

    "Elton W" <> wrote in message
    news:...
    >I don't thinks you can add
    > A 1
    > B 1
    > C 2
    > A 2
    > B 3
    >
    > to a Hashtable. Using Hashtable, key must be unique. In above data, it
    > will
    > throw ArgumentException: Item has already been used...
    >
    > Elton Wang
    >
    > "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:
    >
    >> You can use a datatable which is to generic...
    >>
    >> But if both column's composition is unique, u can use hash table for fast
    >> access. For instance,
    >>
    >> Sample Data:
    >> A 1
    >> B 1
    >> C 2
    >> A 2
    >> B 3
    >>
    >> If u have data like this,
    >>
    >> u can use hash table
    >> either
    >> concatenating key value pairs with a special separator such as "$_$".
    >> and use this string as hash value
    >> or
    >> just use keys as keys and use an arraylist for the changing values
    >> A shows an arraylist containing 1,2
    >> B shows an arraylist containing 1, 3
    >> C should show aan arraylist containing 2
    >>
    >> Hope this helps,
    >>
    >> --
    >>
    >> Thanks,
    >> Yunus Emre ALPÖZEN
    >> BSc, MCSD.NET
    >>
    >> "Andy Sutorius via DotNetMonster.com" <>
    >> wrote
    >> in message news:...
    >> > Hi,
    >> >
    >> > What collection can I use to store name value pairs that contain
    >> > duplicates
    >> > in both columns?
    >> >
    >> > Thanks,
    >> >
    >> > Andy
    >> >
    >> > --
    >> > Message posted via DotNetMonster.com
    >> > http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1

    >>
    >>
    >>
     
    Yunus Emre ALPÖZEN [MCSD.NET], May 28, 2005
    #4
  5. So I only think the second is wrong.

    "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:

    > Just read my post again. I advised two solution two overcome this issue....
    >
    > --
    >
    > Thanks,
    > Yunus Emre ALPÖZEN
    > BSc, MCSD.NET
    >
    > "Elton W" <> wrote in message
    > news:...
    > >I don't thinks you can add
    > > A 1
    > > B 1
    > > C 2
    > > A 2
    > > B 3
    > >
    > > to a Hashtable. Using Hashtable, key must be unique. In above data, it
    > > will
    > > throw ArgumentException: Item has already been used...
    > >
    > > Elton Wang
    > >
    > > "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:
    > >
    > >> You can use a datatable which is to generic...
    > >>
    > >> But if both column's composition is unique, u can use hash table for fast
    > >> access. For instance,
    > >>
    > >> Sample Data:
    > >> A 1
    > >> B 1
    > >> C 2
    > >> A 2
    > >> B 3
    > >>
    > >> If u have data like this,
    > >>
    > >> u can use hash table
    > >> either
    > >> concatenating key value pairs with a special separator such as "$_$".
    > >> and use this string as hash value
    > >> or
    > >> just use keys as keys and use an arraylist for the changing values
    > >> A shows an arraylist containing 1,2
    > >> B shows an arraylist containing 1, 3
    > >> C should show aan arraylist containing 2
    > >>
    > >> Hope this helps,
    > >>
    > >> --
    > >>
    > >> Thanks,
    > >> Yunus Emre ALPÖZEN
    > >> BSc, MCSD.NET
    > >>
    > >> "Andy Sutorius via DotNetMonster.com" <>
    > >> wrote
    > >> in message news:...
    > >> > Hi,
    > >> >
    > >> > What collection can I use to store name value pairs that contain
    > >> > duplicates
    > >> > in both columns?
    > >> >
    > >> > Thanks,
    > >> >
    > >> > Andy
    > >> >
    > >> > --
    > >> > Message posted via DotNetMonster.com
    > >> > http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?RWx0b24gVw==?=, May 28, 2005
    #5
  6. Use the NameValueCollection class.

    Joseph

    "Elton W" <> wrote in message
    news:D...
    > So I only think the second is wrong.
    >
    > "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:
    >
    >> Just read my post again. I advised two solution two overcome this
    >> issue....
    >>
    >> --
    >>
    >> Thanks,
    >> Yunus Emre ALPÖZEN
    >> BSc, MCSD.NET
    >>
    >> "Elton W" <> wrote in message
    >> news:...
    >> >I don't thinks you can add
    >> > A 1
    >> > B 1
    >> > C 2
    >> > A 2
    >> > B 3
    >> >
    >> > to a Hashtable. Using Hashtable, key must be unique. In above data, it
    >> > will
    >> > throw ArgumentException: Item has already been used...
    >> >
    >> > Elton Wang
    >> >
    >> > "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:
    >> >
    >> >> You can use a datatable which is to generic...
    >> >>
    >> >> But if both column's composition is unique, u can use hash table for
    >> >> fast
    >> >> access. For instance,
    >> >>
    >> >> Sample Data:
    >> >> A 1
    >> >> B 1
    >> >> C 2
    >> >> A 2
    >> >> B 3
    >> >>
    >> >> If u have data like this,
    >> >>
    >> >> u can use hash table
    >> >> either
    >> >> concatenating key value pairs with a special separator such as
    >> >> "$_$".
    >> >> and use this string as hash value
    >> >> or
    >> >> just use keys as keys and use an arraylist for the changing values
    >> >> A shows an arraylist containing 1,2
    >> >> B shows an arraylist containing 1, 3
    >> >> C should show aan arraylist containing 2
    >> >>
    >> >> Hope this helps,
    >> >>
    >> >> --
    >> >>
    >> >> Thanks,
    >> >> Yunus Emre ALPÖZEN
    >> >> BSc, MCSD.NET
    >> >>
    >> >> "Andy Sutorius via DotNetMonster.com" <>
    >> >> wrote
    >> >> in message news:...
    >> >> > Hi,
    >> >> >
    >> >> > What collection can I use to store name value pairs that contain
    >> >> > duplicates
    >> >> > in both columns?
    >> >> >
    >> >> > Thanks,
    >> >> >
    >> >> > Andy
    >> >> >
    >> >> > --
    >> >> > Message posted via DotNetMonster.com
    >> >> > http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
     
    Joseph A. De Guzman, Jun 2, 2005
    #6
  7. Hi Joseph,

    It's quite interesting. NameValueCollection also stores key/value pairs by
    unique keys. However, different from HashTable, it can 'Add' multi-values to
    one key, e.g.
    NvCollection.Add("A","1");
    NvCollection.Add("A","2");
    The result is that it concatenates values separated by comma, e.g.
    NvCollection(“Aâ€) = “1,2â€. It seems you can use
    string.split(",".ToCharArray()) to get an value array. But suppose there is
    one value with comma, e.g. "1,000", how do you deal with it?

    Elton Wang



    "Joseph A. De Guzman" wrote:

    > Use the NameValueCollection class.
    >
    > Joseph
    >
    > "Elton W" <> wrote in message
    > news:D...
    > > So I only think the second is wrong.
    > >
    > > "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:
    > >
    > >> Just read my post again. I advised two solution two overcome this
    > >> issue....
    > >>
    > >> --
    > >>
    > >> Thanks,
    > >> Yunus Emre ALPÖZEN
    > >> BSc, MCSD.NET
    > >>
    > >> "Elton W" <> wrote in message
    > >> news:...
    > >> >I don't thinks you can add
    > >> > A 1
    > >> > B 1
    > >> > C 2
    > >> > A 2
    > >> > B 3
    > >> >
    > >> > to a Hashtable. Using Hashtable, key must be unique. In above data, it
    > >> > will
    > >> > throw ArgumentException: Item has already been used...
    > >> >
    > >> > Elton Wang
    > >> >
    > >> > "Yunus Emre ALPÖZEN [MCSD.NET]" wrote:
    > >> >
    > >> >> You can use a datatable which is to generic...
    > >> >>
    > >> >> But if both column's composition is unique, u can use hash table for
    > >> >> fast
    > >> >> access. For instance,
    > >> >>
    > >> >> Sample Data:
    > >> >> A 1
    > >> >> B 1
    > >> >> C 2
    > >> >> A 2
    > >> >> B 3
    > >> >>
    > >> >> If u have data like this,
    > >> >>
    > >> >> u can use hash table
    > >> >> either
    > >> >> concatenating key value pairs with a special separator such as
    > >> >> "$_$".
    > >> >> and use this string as hash value
    > >> >> or
    > >> >> just use keys as keys and use an arraylist for the changing values
    > >> >> A shows an arraylist containing 1,2
    > >> >> B shows an arraylist containing 1, 3
    > >> >> C should show aan arraylist containing 2
    > >> >>
    > >> >> Hope this helps,
    > >> >>
    > >> >> --
    > >> >>
    > >> >> Thanks,
    > >> >> Yunus Emre ALPÖZEN
    > >> >> BSc, MCSD.NET
    > >> >>
    > >> >> "Andy Sutorius via DotNetMonster.com" <>
    > >> >> wrote
    > >> >> in message news:...
    > >> >> > Hi,
    > >> >> >
    > >> >> > What collection can I use to store name value pairs that contain
    > >> >> > duplicates
    > >> >> > in both columns?
    > >> >> >
    > >> >> > Thanks,
    > >> >> >
    > >> >> > Andy
    > >> >> >
    > >> >> > --
    > >> >> > Message posted via DotNetMonster.com
    > >> >> > http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?RWx0b24gVw==?=, Jun 3, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon
    Replies:
    3
    Views:
    23,755
    bruce barker
    Feb 9, 2004
  2. =?Utf-8?B?Sm9l?=

    Adding name-value pair to QueryString Collection?

    =?Utf-8?B?Sm9l?=, Feb 8, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    4,159
    Ravi Ambros Wallau
    Feb 8, 2006
  3. David Lozzi

    Parse value from name/value pair string

    David Lozzi, Jun 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    611
    David Lozzi
    Jun 8, 2006
  4. JDP@Work
    Replies:
    1
    Views:
    131
    JDP@Work
    Dec 19, 2005
  5. Ken Ghosh
    Replies:
    6
    Views:
    162
    Brian Candler
    Sep 9, 2009
Loading...

Share This Page