Hi,
I have keyA: value-a1, value-b1, value-c1
KeyB: value -a2, value-b2. Etc
In general key: multiple values.
A bunch of them.
What is the best and fastest way to find
Key based on value?
I am thinking excel and lookup or switch case.
Please advise most efficient way of finding key corresponding to a value from multiple values.
Thanks a lot
adiijaiin
(Aditya Jain)
May 18, 2023, 1:58pm
2
Hi @A_Learner ,
It would be faster and efficient with Switch.
Lookup on DataTable won’t be fast.
ppr
(Peter)
May 18, 2023, 1:59pm
3
on of many options
LkUp Dictionary with LINQ filter code
Thank you.
Does switch allow multiple case values which are string type?
Regards
@ppr , Can you please provide me an examole?
Thanks
adiijaiin
(Aditya Jain)
May 18, 2023, 2:11pm
6
Yes it will allow multiple string values.
ppr
(Peter)
May 18, 2023, 2:12pm
7
how / which datatype had you forseen for the value, string, array, list, , comma seperated string?
Key is string.
Values for each key are strings.
I need to find key based on value.
Thank you,
Hi,
Can you please provide an example. In switch case multiple string values not working for
Me.
Thanks
Nitya1
(Nitya Tomar)
May 18, 2023, 3:45pm
10
Hi @A_Learner
If you have a collection of keys with multiple values and you need to find a key based on a given value, using a dictionary or a data structure that supports reverse lookup would be the most efficient approach.
Thanks!!
system
(system)
Closed
May 22, 2023, 3:44pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.