none
The call is ambiguous between the following methods or properties

    Question

  • Hi,

    I am receiving this error: The call is ambiguous between the following methods or properties: 'eLegalActs.Win.DialogResultExtension.ToEditFormResult(System.Windows.Forms.DialogResult)' and 'eLegalActs.Win.DialogResultExtension.ToEditFormResult(System.Windows.Forms.DialogResult)' .

    The method ToEditFormResult is extension :

    namespace System.Windows.Forms {

    public enum EditFormResult { Refresh, Ignore, NewEntity };

    public static class DialogResultExtension { public static EditFormResult ToEditFormResult(this DialogResult result) { if (result != null) { switch (result) { case DialogResult.OK: return EditFormResult.Refresh; case DialogResult.Retry: return EditFormResult.NewEntity; case DialogResult.Ignore: return EditFormResult.Ignore; case DialogResult.No: case DialogResult.None: case DialogResult.Abort: case DialogResult.Cancel: case DialogResult.Yes: default: break; } } return EditFormResult.Ignore; } }
    }
    When removing "obj" folder from project, rebuilding all throw an error that:

    Error    919    Metadata file 'I:\eLegalActs.Win\bin\Debug\eLegalActs.Win.exe' could not be found    eLegalActs.Win


    Then hit F5  and it works.
    Any other attemp to complie, build finish with error as on the begining.


    Error is saying that method is ambiguose betweeen my extension and some file from Metadata that is located in:
    C:\Users\lMe\AppData\Local\Temp\1564$eLegalActs.Win.exe$v2.0.50727

    namespace eLegalActs.Win {
    	public static class DialogResultExtension {
    		public static EditFormResult ToEditFormResult(this DialogResult result);
    	}
    }
    


    The strange thing is that namespaces are diffrent in both classes.

    Thanks for help.

    Leszek Koc
    Tuesday, November 10, 2009 7:21 AM

Answers

  • Hello Leszek,

    How did you call the static function if I may ask? I suggest you add the namespace before the method when calling it in our code, for example:
     EditFormResult result = eLegalActs.Win.DialogResultExtension.ToEditFormResult(....);
    This could avoid the "ambiguous" error message.
    By the way, why do you named your namespace System.Windows.Forms? Since this is a .NET Framework assembly, I strongly recommend you use another one instead.

    Please have a try and let me know the result.
    Thanks


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, November 11, 2009 6:04 AM