Click here to Skip to main content
15,879,844 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I restart an at runtime compiled project? Pin
absturz75-Jan-12 12:20
absturz75-Jan-12 12:20 
Questionhow to delete a string[] from list<string[]> ??? Pin
JANARDHAN GURRAM5-Jan-12 7:02
JANARDHAN GURRAM5-Jan-12 7:02 
AnswerRe: how to delete a string[] from list ??? Pin
manognya kota5-Jan-12 7:23
manognya kota5-Jan-12 7:23 
GeneralRe: how to delete a string[] from list ???<solved> Pin
JANARDHAN GURRAM5-Jan-12 7:48
JANARDHAN GURRAM5-Jan-12 7:48 
GeneralRe: how to delete a string[] from list ??? Pin
manognya kota5-Jan-12 7:51
manognya kota5-Jan-12 7:51 
GeneralRe: how to delete a string[] from list ??? Pin
BillWoodruff5-Jan-12 16:24
professionalBillWoodruff5-Jan-12 16:24 
GeneralRe: how to delete a string[] from list ??? Pin
manognya kota5-Jan-12 17:47
manognya kota5-Jan-12 17:47 
AnswerRe: how to delete a string[] from list ??? Pin
Luc Pattyn5-Jan-12 7:59
sitebuilderLuc Pattyn5-Jan-12 7:59 
You can't remove using dataArray.Remove(new string[] { "start2","end2" }); as that new array isn't the same as the original one.

However I see three ways, each taking some additional code:

1.
keep a reference to the item you will want to remove later on:
...
string[] toBeDeletedLater=new string[] { "start2","end2" };
dataArray.Add(toBeDeletedLater);
...
dataArray.Remove(toBeDeletedLater);


2.
remember the index in the list, then use RemoveAt()
int toBeDeletedLater=dataArray.Count;
dataArray.Add(new string[] { "start2","end2" });
...
dataArray.RemoveAt(toBeDeletedLater);

This will fail if other list operations cause the indexes to change...

3.
locate the element you want to delete (worst case: iterate and check the content of each element), then call RemoveAt.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

QuestionMessage Removed Pin
5-Jan-12 5:52
professionalN_tro_P5-Jan-12 5:52 
AnswerRe: Interfaces and Collections Pin
Sentenryu5-Jan-12 6:41
Sentenryu5-Jan-12 6:41 
GeneralMessage Removed Pin
5-Jan-12 6:53
professionalN_tro_P5-Jan-12 6:53 
GeneralRe: Interfaces and Collections Pin
Sentenryu5-Jan-12 7:11
Sentenryu5-Jan-12 7:11 
AnswerRe: Interfaces and Collections Pin
SledgeHammer015-Jan-12 10:38
SledgeHammer015-Jan-12 10:38 
QuestionRe: Interfaces and Collections Pin
Sentenryu5-Jan-12 10:48
Sentenryu5-Jan-12 10:48 
GeneralRe: Interfaces and Collections Pin
BillWoodruff5-Jan-12 16:46
professionalBillWoodruff5-Jan-12 16:46 
GeneralRe: Interfaces and Collections Pin
SledgeHammer015-Jan-12 16:59
SledgeHammer015-Jan-12 16:59 
AnswerRe: Interfaces and Collections Pin
BillWoodruff5-Jan-12 16:44
professionalBillWoodruff5-Jan-12 16:44 
GeneralRe: Interfaces and Collections Pin
SledgeHammer015-Jan-12 16:54
SledgeHammer015-Jan-12 16:54 
GeneralRe: Interfaces and Collections Pin
Sentenryu5-Jan-12 22:13
Sentenryu5-Jan-12 22:13 
GeneralRe: Interfaces and Collections Pin
BillWoodruff5-Jan-12 23:16
professionalBillWoodruff5-Jan-12 23:16 
AnswerRe: Interfaces and Collections Pin
BobJanova9-Jan-12 0:17
BobJanova9-Jan-12 0:17 
QuestionRichTextBox.TextLength vs RichTextBox.Text.Length Pin
morglorf5-Jan-12 5:49
morglorf5-Jan-12 5:49 
AnswerRe: RichTextBox.TextLength vs RichTextBox.Text.Length Pin
morglorf5-Jan-12 6:18
morglorf5-Jan-12 6:18 
GeneralRe: RichTextBox.TextLength vs RichTextBox.Text.Length Pin
Ravi Bhavnani5-Jan-12 7:58
professionalRavi Bhavnani5-Jan-12 7:58 
QuestionHow to read ocr image in MODI using visual studio? Pin
pervaizali5-Jan-12 4:22
pervaizali5-Jan-12 4:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.