Click here to Skip to main content
14,362,031 members
   

C#

 
QuestionUpdate User Environment Variable Pin
DavPCode2-Apr-19 5:50
memberDavPCode2-Apr-19 5:50 
AnswerRe: Update User Environment Variable Pin
OriginalGriff2-Apr-19 6:50
protectorOriginalGriff2-Apr-19 6:50 
GeneralRe: Update User Environment Variable Pin
DavPCode2-Apr-19 8:12
memberDavPCode2-Apr-19 8:12 
GeneralRe: Update User Environment Variable Pin
Richard Deeming2-Apr-19 9:06
mveRichard Deeming2-Apr-19 9:06 
GeneralRe: Update User Environment Variable Pin
DavPCode2-Apr-19 13:07
memberDavPCode2-Apr-19 13:07 
QuestionValues Sum in a file Pin
Member 1420343029-Mar-19 11:46
memberMember 1420343029-Mar-19 11:46 
AnswerRe: Values Sum in a file Pin
OriginalGriff29-Mar-19 22:21
protectorOriginalGriff29-Mar-19 22:21 
AnswerRe: Values Sum in a file Pin
Member 1420343030-Mar-19 4:29
memberMember 1420343030-Mar-19 4:29 
I tried many methods, but only this one worked for me finally:
string[] SplittedValues = FlavorsFile.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries);

Dictionary<string, int=""> ResultsValues = new Dictionary<string, int="">();
for (int i = 0; i < SplittedValues.Length; i++)
{
string[] entry = SplittedValues[i].Split(new string[] { ":" }, StringSplitOptions.None);

if (ResultsValues.ContainsKey(entry[0]))
{
ResultsValues[entry[0]] = ResultsValues[entry[0]] + int.Parse(entry[1]);
}
else
{
ResultsValues.Add(entry[0], int.Parse(entry[1]));

}
}

Thank You!
AnswerRe: Values Sum in a file Pin
BillWoodruff31-Mar-19 20:25
mveBillWoodruff31-Mar-19 20:25 
QuestionSplit lines in a file Pin
Member 1420343029-Mar-19 9:34
memberMember 1420343029-Mar-19 9:34 
AnswerRe: Split lines in a file Pin
OriginalGriff29-Mar-19 10:11
protectorOriginalGriff29-Mar-19 10:11 
QuestionException while trying reading a local file using online compiler Pin
Member 1420343029-Mar-19 7:28
memberMember 1420343029-Mar-19 7:28 
AnswerRe: Exception while trying reading a local file using online compiler Pin
OriginalGriff29-Mar-19 7:42
protectorOriginalGriff29-Mar-19 7:42 
GeneralRe: Exception while trying reading a local file using online compiler Pin
Member 1420343029-Mar-19 8:19
memberMember 1420343029-Mar-19 8:19 
GeneralRe: Exception while trying reading a local file using online compiler Pin
OriginalGriff29-Mar-19 8:23
protectorOriginalGriff29-Mar-19 8:23 
GeneralRe: Exception while trying reading a local file using online compiler Pin
Dave Kreskowiak29-Mar-19 10:44
mveDave Kreskowiak29-Mar-19 10:44 
GeneralRe: Exception while trying reading a local file using online compiler Pin
Member 1420343029-Mar-19 11:48
memberMember 1420343029-Mar-19 11:48 
QuestionGetting exception message "Incorrect syntax near '(' " in C# web app Pin
Member 1420265628-Mar-19 21:10
memberMember 1420265628-Mar-19 21:10 
AnswerRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
GenJerDan28-Mar-19 21:58
memberGenJerDan28-Mar-19 21:58 
AnswerRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
OriginalGriff28-Mar-19 22:04
protectorOriginalGriff28-Mar-19 22:04 
AnswerRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
Luc Pattyn29-Mar-19 0:39
professionalLuc Pattyn29-Mar-19 0:39 
GeneralRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
OriginalGriff29-Mar-19 0:42
protectorOriginalGriff29-Mar-19 0:42 
GeneralRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
Luc Pattyn29-Mar-19 0:47
professionalLuc Pattyn29-Mar-19 0:47 
GeneralRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
GenJerDan29-Mar-19 2:39
memberGenJerDan29-Mar-19 2:39 
GeneralRe: Getting exception message "Incorrect syntax near '(' " in C# web app Pin
Eddy Vluggen29-Mar-19 3:56
mveEddy Vluggen29-Mar-19 3:56 

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.