Last post Jun 11, 2009 06:53 PM by Tonie
Jun 11, 2009 05:19 AM|Tonie|LINK
I have a function that accepts a list as the parameter and creates a CSV from the passed list.
Currently, the List parameter is of type String i.e.
Public Function GenerateCSV(ByVal Source As List(Of String)) As String
My question is, is there a way I could modify the parameter such that it accepts a list of any known type i.e either string, integer etc instead of forcing it accept of type string as I have done above?
Thank you in advance
Jun 11, 2009 05:54 AM|chintanpshah|LINK
Private Sub Test(ByVal ParamArray myParams() As Object)
Jun 11, 2009 05:56 AM|chintanpshah|LINK
private void Test(params object test)
Jun 11, 2009 07:51 AM|BlueJam|LINK
Also, the following should work :-
Jun 11, 2009 09:34 AM|David Anton|LINK
This is a perfect use for generics:
Public Function GenerateCSV(Of T)(ByVal Source As List(Of T)) As String
This function can be passed a List of any type.
Jun 11, 2009 06:53 PM|Tonie|LINK
Thank you all for your responses. They've been of great help to me. [:D]