public void removeEntry(string[] array, string entry)
{
// Use a temporary array
string[] tmp = new string[array.Length];
for (int i = 0; i < array.Length; i++)
{
// Only add the ones that are NOT the unwanted entry to tmp
if (array != entry)
{
tmp = array;
}
}
// Replace filter by the temporary array
array = tmp;
}
string[] filter ={"a", "b", "c", "d", "e"};
removeEntry(filter, "d");
Public string[] RemoveElement(string[] inArray, int index){
int tIndex = 0;
string returnArray = new string[inArray.size-1];
for(int i = 0; i < inArray.size; i++){
if(i != index){
returnArray[tIndex] = inArray [i];
tIndex ++;
}
}
return returnArray;
}
I hate to be this guy and ask another stupid wuestion. The reason I was using an array was because I could not find out how to convert a multiline textbox to an array list. Can someone help me with that?
var list = txtbox.Lines.ToList();
var arr = list.ToArray();
arraylist mate not arrays![]()