VB.NET to C# conversion problem

I am trying to convert this piece of code to c# and i am having some trouble because of the name differences in the functions the vb application is inheriting:


  Public Sub ApplyEdit() Implements IEditableObject.EndEdit
    mBindingEdit = False
    AcceptChanges()
  End Sub


I know that when i inherit from this in c# i need to implement the EndEdit function, i just don't know how to say my function called ApplyEdit should be implementing EndEdit in c# or if this is possible.  If not, how would i go about doing this correctly   Thanks in advance.


Answer this question

VB.NET to C# conversion problem

  • OleGrytdal

    the IEditableObject interface does not have a method called ApplyEdit, it is called EndEdit.  What i want to know is if and how to call IEditableObject.EndEdit with a different method name, such as ApplyEdit.  I am wondering if this can be accomplished by shadowing maybe...not sure.
  • Jwright6764

    Oh .. I see

    This is from the MSDN

    In Visual C#, you cannot implement an interface member with a method of a different name, such as you can in Visual Basic .NET using the Implements keyword.

    What you could do is implementing EndEdit and a sub/property ApplyEdit that calls EndEdit

  • Christina M

    i think like so

    void IEditableObject.ApplyEdit()
    {

        mBindingEdit = False;
        AcceptChanges();

    }
      


    Remco

  • VB.NET to C# conversion problem