Click here to Skip to main content
14,331,191 members
   

C#

 
GeneralRe: Newbie: if/else Pin
Member 1434938430-Apr-19 4:23
memberMember 1434938430-Apr-19 4:23 
GeneralRe: Newbie: if/else Pin
OriginalGriff30-Apr-19 4:30
protectorOriginalGriff30-Apr-19 4:30 
GeneralRe: Newbie: if/else Pin
Richard MacCutchan30-Apr-19 5:47
protectorRichard MacCutchan30-Apr-19 5:47 
GeneralRe: Newbie: if/else Pin
OriginalGriff30-Apr-19 5:52
protectorOriginalGriff30-Apr-19 5:52 
GeneralRe: Newbie: if/else Pin
Richard MacCutchan30-Apr-19 6:02
protectorRichard MacCutchan30-Apr-19 6:02 
GeneralRe: Newbie: if/else Pin
OriginalGriff30-Apr-19 6:28
protectorOriginalGriff30-Apr-19 6:28 
GeneralRe: Newbie: if/else Pin
Richard MacCutchan30-Apr-19 21:32
protectorRichard MacCutchan30-Apr-19 21:32 
AnswerRe: Newbie: if/else Pin
BillWoodruff30-Apr-19 18:07
mveBillWoodruff30-Apr-19 18:07 
well, while you are here, see if you get some ideas from this, and see this for more ideas: [^]
int result = -1;
int converted = 0;

bool conversionok = false;

Console.WriteLine("Enter an integer, or 'stop'");

string input = Console.ReadLine();

if (input == "stop")
{
    Console.WriteLine($"stopped: result = {result}");
}
else
{
    conversionok = Int32.TryParse(input, out converted);

    if (conversionok)
    {
        result = result + converted;
        Console.WriteLine($"conversion ok: result = {result}");
    }
    else
    {
        Console.WriteLine($"conversion fail: result = {result}");
    }
}

Console.ReadLine();
Yes, this code can be simplified; it is written out "more fully" here for educational purposes.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

AnswerRe: Newbie: if/else Pin
David A. Gray3-May-19 7:40
groupDavid A. Gray3-May-19 7:40 
QuestionRound Corner in C# windows foam application Pin
Member 1434920730-Apr-19 1:20
memberMember 1434920730-Apr-19 1:20 
AnswerRe: Round Corner in C# windows foam application Pin
Eddy Vluggen30-Apr-19 1:27
mveEddy Vluggen30-Apr-19 1:27 
GeneralRe: Round Corner in C# windows foam application Pin
BillWoodruff30-Apr-19 18:42
mveBillWoodruff30-Apr-19 18:42 
GeneralRe: Round Corner in C# windows foam application Pin
Eddy Vluggen1-May-19 1:03
mveEddy Vluggen1-May-19 1:03 
AnswerRe: Round Corner in C# windows foam application Pin
Gerry Schmitz30-Apr-19 1:56
mveGerry Schmitz30-Apr-19 1:56 
AnswerRe: Round Corner in C# windows foam application Pin
BillWoodruff30-Apr-19 18:40
mveBillWoodruff30-Apr-19 18:40 
QuestionHow to get the MaxValue using LINQ ?! Pin
Abdalla Ben Omran29-Apr-19 2:24
memberAbdalla Ben Omran29-Apr-19 2:24 
AnswerRe: How to get the MaxValue using LINQ ?! Pin
OriginalGriff29-Apr-19 3:00
protectorOriginalGriff29-Apr-19 3:00 
GeneralRe: How to get the MaxValue using LINQ ?! Pin
Abdalla Ben Omran29-Apr-19 3:17
memberAbdalla Ben Omran29-Apr-19 3:17 
GeneralRe: How to get the MaxValue using LINQ ?! Pin
OriginalGriff29-Apr-19 3:55
protectorOriginalGriff29-Apr-19 3:55 
GeneralRe: How to get the MaxValue using LINQ ?! Pin
Richard Deeming1-May-19 8:22
mveRichard Deeming1-May-19 8:22 
AnswerRe: How to get the MaxValue using LINQ ?! Pin
Dave Kreskowiak29-Apr-19 3:10
mveDave Kreskowiak29-Apr-19 3:10 
AnswerRe: How to get the MaxValue using LINQ ?! Pin
Maciej Los29-Apr-19 9:04
protectorMaciej Los29-Apr-19 9:04 
GeneralRe: How to get the MaxValue using LINQ ?! Pin
OriginalGriff29-Apr-19 20:14
protectorOriginalGriff29-Apr-19 20:14 
PraiseRe: How to get the MaxValue using LINQ ?! Pin
Maciej Los29-Apr-19 20:29
protectorMaciej Los29-Apr-19 20:29 
GeneralRe: How to get the MaxValue using LINQ ?! Pin
OriginalGriff29-Apr-19 20:42
protectorOriginalGriff29-Apr-19 20:42 

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.