What type of Object is vmName? Is it an indexable type. I assume looking at the snippet it is a simple string and not indexable.
Console.Writeline(vmName); //Might be more appropriate Steve On May 11, 6:33 am, Karsten_Markmann <[email protected]> wrote: > Hi > I am having some third party code that returns me an ArrayList. > In this list there are X number of objects that each hold 2 objects. > I must retrieve the object on postion [1] of each object returned in > the list. > > I have the following code snippet, which gives me a compiler error: > Cannot apply indexing with [] to an expression of type 'object' > > ArrayList al = new ArrayList(); > > al = clientInfo.SvcUtil.GetDecendentMoRefs(mor, "VirtualMachine"); > > for (int vm = 0; vm <= al.Count - 1; vm++) > { > vmName = al[vm]; > > Console.WriteLine(vmName[1]); > } > > I am a bit stuck, solving this problem. Any help is appriciated. > Kind Regards > Karsten Markmann
