Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
GeneralRe: Facebook session key question Pin
Etienne_12316-Jul-10 1:19
Etienne_12316-Jul-10 1:19 
GeneralRe: Facebook session key question Pin
Eddy Vluggen16-Jul-10 3:23
professionalEddy Vluggen16-Jul-10 3:23 
QuestionHelp Regarding DATARELATIONSHIP Pin
amaankhan15-Jul-10 21:20
amaankhan15-Jul-10 21:20 
AnswerRe: Help Regarding DATARELATIONSHIP Pin
Peace ON15-Jul-10 21:33
Peace ON15-Jul-10 21:33 
QuestionCircular dependency in dlls Pin
Blubbo15-Jul-10 7:53
Blubbo15-Jul-10 7:53 
AnswerRe: Circular dependency in dlls Pin
Richard MacCutchan15-Jul-10 9:00
mveRichard MacCutchan15-Jul-10 9:00 
GeneralRe: Circular dependency in dlls Pin
Blubbo15-Jul-10 9:02
Blubbo15-Jul-10 9:02 
GeneralRe: Circular dependency in dlls Pin
Richard MacCutchan15-Jul-10 9:37
mveRichard MacCutchan15-Jul-10 9:37 
AnswerRe: Circular dependency in dlls Pin
_Maxxx_15-Jul-10 18:05
professional_Maxxx_15-Jul-10 18:05 
GeneralRe: Circular dependency in dlls Pin
Blubbo19-Jul-10 2:26
Blubbo19-Jul-10 2:26 
QuestionError when using stored procedure in C#.net Pin
Dhyanga15-Jul-10 5:08
Dhyanga15-Jul-10 5:08 
AnswerRe: Error when using stored procedure in C#.net Pin
T M Gray15-Jul-10 6:25
T M Gray15-Jul-10 6:25 
GeneralRe: Error when using stored procedure in C#.net Pin
Dhyanga15-Jul-10 6:30
Dhyanga15-Jul-10 6:30 
AnswerRe: Error when using stored procedure in C#.net Pin
GgAben21-Jul-10 2:06
GgAben21-Jul-10 2:06 
Questionhi can any one suggest me quickest(optimized) way to call an stored procedure from my c# code for every row of data table (rows can be for example 20000)? what is "optimized" ? Pin
sohailch4015-Jul-10 3:45
sohailch4015-Jul-10 3:45 
AnswerRe: hi can any one suggest me quickest(optimized) way to call an stored procedure from my c# code for every row of data table (rows can be for example 20000)? what is "optimized" ? Pin
Ennis Ray Lynch, Jr.15-Jul-10 3:55
Ennis Ray Lynch, Jr.15-Jul-10 3:55 
QuestionDictionary <-> JSON Pin
softwarejaeger15-Jul-10 1:57
softwarejaeger15-Jul-10 1:57 
AnswerRe: Dictionary JSON Pin
Peace ON15-Jul-10 2:12
Peace ON15-Jul-10 2:12 
You can use Json.NET[^] for the same.

However, I have found one class which converts Dictionary to String that might help you.

C#
class ConvertDictionary
{
    Dictionary<string, int> _dictionary = new Dictionary<string, int>()
    {
        {"salmon", 5},
        {"tuna", 6},
        {"clam", 2},
        {"asparagus", 3}
    };

    public ConvertDictionary()
    {
        // Convert dictionary to string and save
        string s = GetLine(_dictionary);
        File.WriteAllText("dict.txt", s);
        // Get dictionary from that file
        Dictionary<string, int> d = GetDict("dict.txt");
    }

    string GetLine(Dictionary<string, int> d)
    {
        // Build up each line one-by-one and them trim the end
        StringBuilder builder = new StringBuilder();
        foreach (KeyValuePair<string, int> pair in d)
        {
            builder.Append(pair.Key).Append(":").Append(pair.Value).Append(',');
        }
        string result = builder.ToString();
        // Remove the final delimiter
        result = result.TrimEnd(',');
        return result;
    }

    Dictionary<string, int> GetDict(string f)
    {
        Dictionary<string, int> d = new Dictionary<string, int>();
        string s = File.ReadAllText(f);
        // Divide all pairs (remove empty strings)
        string[] tokens = s.Split(new char[] { ':', ',' },
            StringSplitOptions.RemoveEmptyEntries);
        // Walk through each item
        for (int i = 0; i < tokens.Length; i += 2)
        {
            string name = tokens[i];
            string freq = tokens[i + 1];

            // Parse the int (this can throw)
            int count = int.Parse(freq);
            // Fill the value in the sorted dictionary
            if (d.ContainsKey(name))
            {
                d[name] += count;
            }
            else
            {
                d.Add(name, count);
            }
        }
        return d;
    }
}




HTH
Jinal Desai - LIVE
Experience is mother of sage....

Questionmove items up and down in listbox Pin
NarVish15-Jul-10 1:29
NarVish15-Jul-10 1:29 
AnswerRe: move items up and down in listbox Pin
Peace ON15-Jul-10 1:45
Peace ON15-Jul-10 1:45 
GeneralRe: move items up and down in listbox Pin
NarVish15-Jul-10 3:37
NarVish15-Jul-10 3:37 
QuestionQuestion on reflection Pin
Dewald14-Jul-10 23:30
Dewald14-Jul-10 23:30 
AnswerRe: Question on reflection Pin
Arun Jacob14-Jul-10 23:36
Arun Jacob14-Jul-10 23:36 
GeneralRe: Question on reflection Pin
Dewald15-Jul-10 0:57
Dewald15-Jul-10 0:57 
AnswerRe: Question on reflection [modified] Pin
PIEBALDconsult15-Jul-10 3:25
mvePIEBALDconsult15-Jul-10 3:25 

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.