Sorry if this is a dumb question. I don’t ever have to write anything in VB.NET.
But I am passing variables named “name” to a function and sometimes it may be 1 name or 2 names, etc. I want to check in the function if its only 1 name don’t add a comma, if it’s 2 names add a comma. Is there a way to get how many “names” there are?
EDIT: Added my ode to make my question a little more clear. sorry for not doing it before.
My Code:
Public Function GenerateCSV(byval str as string, byval str1 as string, byval str2 as string, byval GrpName as string)
IF GroupName <> GrpName THEN
GroupName = GrpName
CSVString = ""
END IF
IF str = ""
CSVString = ""
ELSE
CSVString = CSVString & str & ", " & str1 & ", " & str2 & ", "
END IF
return CSVString
End function
Thanks!
Pass them as a List or array. With these, you can get the number of items and do whatever processing you need to do.
You would preferably use IEnumerable which can take arrays or list among other things. You could use IList(Of String) or String() if you wanted though.