R
Raymond Du
Hi,
For the following code snippets:
public static List<T> getListFromConfig<T>(List<T> objList, int uniqueID,
string
fileDirectory, string fileName, string configName)
where T: new()
{
//some codes to add items to objList
return objList;
}
I have the following questions:
(1) "getListFromConfig<T>", what is the purpose of <T>? Does
getListFromConfig<List<T> > make sense at all?
(2) What does "where T: new()" do?
(3) The function take a List<T> as the first parameter: objList, then it
returns objList. Will the following codes do the same thing?
public static void getListFromConfig<T>(List<T> objList, int uniqueID,
string
fileDirectory, string fileName, string configName)
where T: new()
{
//some codes to add items to objList
//return nothing here since objList will be sent back to the caller.
}
TIA
For the following code snippets:
public static List<T> getListFromConfig<T>(List<T> objList, int uniqueID,
string
fileDirectory, string fileName, string configName)
where T: new()
{
//some codes to add items to objList
return objList;
}
I have the following questions:
(1) "getListFromConfig<T>", what is the purpose of <T>? Does
getListFromConfig<List<T> > make sense at all?
(2) What does "where T: new()" do?
(3) The function take a List<T> as the first parameter: objList, then it
returns objList. Will the following codes do the same thing?
public static void getListFromConfig<T>(List<T> objList, int uniqueID,
string
fileDirectory, string fileName, string configName)
where T: new()
{
//some codes to add items to objList
//return nothing here since objList will be sent back to the caller.
}
TIA