Way to pad an array to avoid index outside of bounds of array error
问题 I expect to have at least 183 items in my list when I query it, but sometimes the result from my extract results in items count lower than 183. My current fix supposedly pads the array in the case that the count is less than 183. if (extractArray.Count() < 183) { int arraysize= extractArray.Count(); var tempArr = new String[183 - arraysize]; List<string> itemsList = extractArray.ToList<string>(); itemsList.AddRange(tempArr); var values = itemsList.ToArray(); //-- Process the new array that is