In the methodpublic static void Copy(List source, List destination) I want to understand the meaning after copy. In the methodpublic static void Copy(List source, List destination) I want to understand the meaning after copy. Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Scott LyslePosted Jan 5, 2009, 3:08 PM
It is there to cue the compiler to confirm the type; you need not add the type to the call when you use your copy command but it works with or without it so long as the source and target lists are of the same type:
private
void Form1_Load(object sender, EventArgs e){
List<string> sourceList = new List<string>(); List<string> targetList = new List<string>();sourceList.Add(
"A");sourceList.Add(
"B");sourceList.Add(
"C");Copy(sourceList, targetList);
for(int i=0; i}
public static void Copy{
{
target.Add(obj);
}
}