Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a List of string into an object

Tags:

vb.net

I am looking for a way to convert my List(Of string) into an Object in vb. So in the end it would be the same as declaring Dim cArray() As Object = new Object. Can anyone point me to how i can achieve this? I cannot use the LINQ .ToArray as that creates a string array and this is not acceptable for my work. I need to pass this object into another one that has the parameter (aArray as Object).

Thanks

like image 563
John Baum Avatar asked Sep 17 '25 04:09

John Baum


1 Answers

So you want to pass the entire array to a single Object? That's an implicit conversion, you don't need to do anything. If it takes an array of Object, you can use .Cast(Of Object)().ToArray(). But consider changing the destination method if at all possible to avoid unnecessary casting back and forth between the two.

like image 67
Ry- Avatar answered Sep 19 '25 15:09

Ry-



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!