Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# convert string array to int array

// Convert all the strings to integers
string[] stringIds = new string[] {"1", "2", "3"};
int[] ids = Array.ConvertAll(stringIds, s => {
  // The TryPrase() Method allows you to receive information
  // whether a element in the array was successfully converted
  bool success = int.TryParse(s, out int result);
  return result;
});
 
PREVIOUS NEXT
Tagged: #convert #string #array #int #array
ADD COMMENT
Topic
Name
2+4 =