Click here to Skip to main content
16,015,969 members
Home / Discussions / C#
   

C#

 
AnswerSame question in four forums Pin
dan!sh 26-May-08 22:20
professional dan!sh 26-May-08 22:20 
QuestionHelp wanted Pin
Saiyed Alam26-May-08 20:52
Saiyed Alam26-May-08 20:52 
AnswerRe: Help wanted Pin
D i x y26-May-08 21:35
D i x y26-May-08 21:35 
GeneralRe: Help wanted Pin
Saiyed Alam26-May-08 23:03
Saiyed Alam26-May-08 23:03 
QuestionGetting key from the value Pin
N a v a n e e t h26-May-08 20:38
N a v a n e e t h26-May-08 20:38 
AnswerRe: Getting key from the value Pin
S. Senthil Kumar26-May-08 20:51
S. Senthil Kumar26-May-08 20:51 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 20:59
N a v a n e e t h26-May-08 20:59 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 21:06
N a v a n e e t h26-May-08 21:06 
This is what I have done.
public bool TryGetCategory(string value, out string category)
{
    category = null;
    if (this.ContainsValue(value))
    {
        // Iterating through the key value pair to look for it's key
        foreach (KeyValuePair<string, string> pair in this)
        {
            if (pair.Value == value)
            {
                // We found a match. So assigning category
                category = pair.Key;
                return true;
            }
        }
    }
    return false;
}
This method is in a class which inherits from Dictionary<string,string>

All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

AnswerRe: Getting key from the value Pin
dan!sh 26-May-08 20:55
professional dan!sh 26-May-08 20:55 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 21:01
N a v a n e e t h26-May-08 21:01 
GeneralRe: Getting key from the value Pin
dan!sh 26-May-08 21:14
professional dan!sh 26-May-08 21:14 
GeneralRe: Getting key from the value Pin
dan!sh 26-May-08 21:21
professional dan!sh 26-May-08 21:21 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 21:56
N a v a n e e t h26-May-08 21:56 
AnswerRe: Getting key from the value Pin
Guffa26-May-08 21:53
Guffa26-May-08 21:53 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 21:58
N a v a n e e t h26-May-08 21:58 
GeneralRe: Getting key from the value Pin
leppie26-May-08 23:03
leppie26-May-08 23:03 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 23:12
N a v a n e e t h26-May-08 23:12 
GeneralRe: Getting key from the value Pin
Guffa26-May-08 23:07
Guffa26-May-08 23:07 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 23:49
N a v a n e e t h26-May-08 23:49 
GeneralRe: Getting key from the value Pin
Guffa27-May-08 0:14
Guffa27-May-08 0:14 
GeneralRe: Getting key from the value Pin
N a v a n e e t h27-May-08 0:46
N a v a n e e t h27-May-08 0:46 
GeneralRe: Getting key from the value Pin
Guffa27-May-08 1:47
Guffa27-May-08 1:47 
GeneralRe: Getting key from the value Pin
N a v a n e e t h27-May-08 6:15
N a v a n e e t h27-May-08 6:15 
AnswerRe: Getting key from the value Pin
S. Senthil Kumar26-May-08 22:33
S. Senthil Kumar26-May-08 22:33 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 22:39
N a v a n e e t h26-May-08 22:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.