I'm calling a method which takes an array of integers representing IDs of records to be deleted:
service.Delete(IDArray)
However I only want to delete a single record so I only have a single value. Obviously I could do something like this:
Dim IDArray(0) as Integer
IDArray(0) = ID
service.Delete(IDArray)
However it looks quite kludgy. Is there a neat way to do this in a single line with some sort of clever array construction syntax?
This is pretty neat:
service.Delete(New integer(0){ID})
and, as Dominc suggests, this is even neater (although I like being explicit):
service.Delete({ID})
Check the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With