Tech Off Thread

8 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

C# Interface demands Overriding and other oddities

Back to Forum: Tech Off
  • User profile image
    W3bbo

    'lo

    I recently converted a VB interface over to C# to take advantage of inline commenting.

    But since doing that, all my VB classes that implement the interfaces now fail, saying that the signatures aren't the same.

    Specifically, the blue wavy line under the VB class definition uses the modifier "Overridable".

    Regardless, I pressed the Return key after the Implements declaration for the IDE to auto-insert the definitions.

    But then, the IDE's auto-insert failed, the newly added code doesn't implement the required members either.

    So I've gone back to the VB interfaces, sans documentation.

    Any ideas?

  • User profile image
    borosen

    Not regarding the interface thing, but what about VBCommenter to get your code commented?

  • User profile image
    Andrew Davey

    Hmm, have you made sure to re-build all projects, etc?
    What version of .NET are you using?
    Can you post the offending code?

  • User profile image
    W3bbo

    Andrew Davey wrote:

    Hmm, have you made sure to re-build all projects, etc?
    What version of .NET are you using?
    Can you post the offending code?



    This would be the problem (requires Flash and a huge display resolution)

  • User profile image
    Shark_M

    how do you set the yellowish /golden theme for xp that you have in the demo of the problem?

  • User profile image
    Andrew Davey

    What about the C# interface?

  • User profile image
    W3bbo

    Shark_M wrote:
    how do you set the yellowish /golden theme for xp that you have in the demo of the problem?


    Uh...

    Control Panel > Display > Appearance {

        Windows and Buttons = Windows Classic Style;
        Color scheme = Maple;

        Advanced > Item {
            Active Window Border = 1px Maroon;
            Scrollbar size = 16;

        }

    }


    Andrew Davey wrote:
    What about the C# interface?


    The C# causing the error is this:

    using System;
    using W3b.Insecticide.Library.Validation;
    
    namespace W3b.Insecticide.DAL {
        
        public interface IDal {
    
            // Snip
    
        ValidationResult Validate(string Query, ObjectType ObjectType, ref Int64 Output);
        ValidationResult Validate(ref Int64 Query, ObjectType ObjectType);
            // Snip        
    
        }
    }
    

  • User profile image
    Tensor

    W3bbo wrote:
    'lo

    I recently converted a VB interface over to C# to take advantage of inline commenting.

    But since doing that, all my VB classes that implement the interfaces now fail, saying that the signatures aren't the same.

    Specifically, the blue wavy line under the VB class definition uses the modifier "Overridable".

    Regardless, I pressed the Return key after the Implements declaration for the IDE to auto-insert the definitions.

    But then, the IDE's auto-insert failed, the newly added code doesn't implement the required members either.

    So I've gone back to the VB interfaces, sans documentation.

    Any ideas?



    A few things.

    First, see earlier post by someone reXML comments. Also VB in 2005 has XML comments.

    the must override function blah blah is the expected error message when you implement an interface but not all its members.

    I think you may have stumbled accross some odities with the differences in how VB and c# implement interfaces. For example the method implementing an interface can have a different name to the interfaces method - notice yhe second of your methods that implements Validate is called Validate1. This would not be possible in C# - a method implementing IDal.Validate must be called Validate - in VB it can be called Validate, Validate1, Bernard, whatever. Try renaming Validate1 to Validate to see if that helps.

    Alternatively - what happens if you delete both those signitures, then add them in by clicking in the right hand drop down, select IDAL, then the left hand drop down and select the method you want to implement (should be none-bold italic) and add them in that way, one at a time?

    I implemented a quick simple test and couldnt duplicate your problem.


Conversation locked

This conversation has been locked by the site admins. No new comments can be made.