SIMIN Posted March 19, 2008 Posted March 19, 2008 Hi, I have a string array. I want to reverse its members, is there a direct way to do this? For example: Input array: a1 a2 a3 a4 a5 Output array: a6 a5 a4 a3 a2 a1 ??? Quote
Administrators PlausiblyDamp Posted March 19, 2008 Administrators Posted March 19, 2008 The Array class has a Reverse method that should do this e.g. Dim test() As String = {"a1", "a2", "a3"} Array.Reverse(test) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
SIMIN Posted March 19, 2008 Author Posted March 19, 2008 Yes I know, but I get warning: MyArray.Reverse(MyArray) Warning 1: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. Quote
Administrators PlausiblyDamp Posted March 19, 2008 Administrators Posted March 19, 2008 Just use Array.Reverse - VB has a pointless feature where it shows shared functions (functions that are accessed via the classname) for a variables intellisense, then warns you about doing it wrong :confused: Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.