I have an If statement that checks a number of things (BaySlots() is an array of strings).
If (Not BaySlots.Contains(Not String.Empty)) OrElse
(Not BayAcId = 0 AndAlso Not BayAcId = acProgramId _
AndAlso overrideSetting = False) Then
I though the Array.Contains method of the first condition would be sufficient to tell me if the array held only empty strings, but it gives InvalidCastException: Conversion from string "" to type Long is not valid so I'm guessing Not String.Empty is actually evaluated to something that is attempted to be converted to a Long.
Is there a better method I can use to retro-fit this If, so that I can still include the test for only empty strings in the array, as part of the If, rather than having to add a preceding loop to test each index of BaySlots() for an empty string?
I thought there should probably be some way of testing this other than looping as that would be a relative lot of work just to test if there was no content.
Thanks
PS just to clarify this is not to test if the array has zero dimensions or is equal to Nothing but that the strings it does contain are all equal to String.Empty.
Nothing, or you only want it to return true if they are all non-empty string objects?Allwill do exactly what you want.