My linux world » cs Convert / Parse

cs Convert / Parse


Contents

Convert String to int

Parse

int value = Int32.Parse("1234");

Convert

int value = Convert.ToInt32("1234");

TryParse

int value;
if (Int32.TryParse("1234", out value))
{ // parse succeed.
  (...)
}
else
{ // parse fails
  (..)
}

Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.