Question

I used to have the following code:

var root = new RootElement ("Tasks"){
    new Section ("Process Type"){
        new RootElement ("Process", new RadioGroup ("processtype", 0)){
            new Section (){
                guarantor,dependent, volunteer // all these are Elements    
            }
        }
    }       
}; 

Now, I update Monotouch SDK, Xcode 5, etc... and when I try to build the project I get an error on the following line:

new RootElement ("Process", new RadioGroup ("processtype", 0)){

with the following error:

HumanResources/HumanPendingRequests.cs(18,18): Error CS0121: The call is ambiguous between the following methods or properties: `MonoTouch.Dialog.Section.Add(MonoTouch.Dialog.Element)' and `MonoTouch.Dialog.Section.Add(System.Collections.Generic.IEnumerable<MonoTouch.Dialog.Element>)' (CS0121)

Any clue on how to fix it and why is now showing that error?

Thanks a lot.

Was it helpful?

Solution

That's strange, but easy to fix. Force a cast to the type you meant, and the c# compiler will find the right overload.

var root = new RootElement ("Tasks"){
    new Section ("Process Type"){
        (MonoTouch.Dialog.Element)new RootElement ("Process", new RadioGroup ("processtype", 0)){
            new Section (){
                guarantor,dependent, volunteer // all these are Elements    
            }
        }
    }       
}; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top