2013-09-25 2 views
1

Я использовал следующий код:Monotouch.Dialog ошибка на новом обновлении

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  
      } 
     } 
    }  
}; 

Теперь я обновляю Monotouch SDK, Xcode 5, и т.д ... и когда я пытаюсь построить проект, я получаю сообщение об ошибке на следующая строка:

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

со следующей ошибкой:

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) 

Любой ключ о том, как фи x это и почему теперь показывает эту ошибку?

Большое спасибо.

ответ

0

Это странно, но легко исправить. Принудительное приведение к типу, который вы имели в виду, и компилятор c# найдет правильную перегрузку.

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  
      } 
     } 
    }  
}; 
Смежные вопросы