I have no idea what the less than / greater than "<>" mean in C#, and what are the preconditions for calling the below function?
public static string ArrayToStringGeneric
{
...blah
return outputString;
}
what would the function call syntax look like? Thanks in advance!
Loading
Santhosh NPosted Dec 9, 2010, 9:13 PM
If you are referring to <> from above code snippet, there are used to specify the type (datatype) of the list items (collections)
Say for example, you wanted to have a collection of integers, then you can can define a list as
List
and you can add items to this as
countryCodes.Add(1);
countryCodes.Add(91);
...
and you can access the items same as array
countryCodes[index]
These are generics where in you can specify the type before hand and avoid type casting issues while working with the items..