How to convert string array to integer array
Hi.. Who knows how to convert string array to integer array..? Can help ?? thanks..
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Feb 28, 2011, 6:24 AM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 28, 2011, 10:16 AM EST
Try this with your code.
public static class ExtensionMethods { public static string[] ToStringArray(this int[] intArray) { return Array.ConvertAll(intArray, delegate(int intParameter) { return intParameter.ToString(); }); } public static int[] ToIntArray(this string[] strArray) { return Array.ConvertAll(strArray, delegate(string intParameter) { return int.Parse(intParameter.ToString()); }); } } This is extension methods you can use this your project.