Switch Vs Lookup


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

Hi @A_Learner ,

It would be faster and efficient with Switch.
Lookup on DataTable won’t be fast.

on of many options
LkUp Dictionary with LINQ filter code

Thank you.
Does switch allow multiple case values which are string type?


@ppr, Can you please provide me an examole?


Yes it will allow multiple string values.

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,

Can you please provide an example. In switch case multiple string values not working for


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.


Thank you @Nitya1 @ppr @adiijaiin

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.