Implement an interface method with a return value

  • Thread starter Thread starter dba
  • Start date Start date
D

dba

Hello All,

And thanks in advance for taking the time to read this. I was
given an interface definition to a COM object. Now I'd like to be able
to compile the interface into it's own assembly and just reference the
assembly from my project so that I'm more decoupled from the
implementation. I have this method:

public static Error[] Validate(string connectionString, string query)
(no I didn't write this I know it's not cohesive but it's what I got.)

I get Validate(string, string)': not all code paths return a value.

Do I just have to put the interface in my own project and implement it
so I don't get this error?

Thanks again!
 
dba said:
And thanks in advance for taking the time to read this. I was
given an interface definition to a COM object. Now I'd like to be able
to compile the interface into it's own assembly and just reference the
assembly from my project so that I'm more decoupled from the
implementation. I have this method:

public static Error[] Validate(string connectionString, string query)
(no I didn't write this I know it's not cohesive but it's what I got.)

I get Validate(string, string)': not all code paths return a value.

Do I just have to put the interface in my own project and implement it
so I don't get this error?

Well, a static method can't implement an interface method, so I'm not
sure I see the link between the two - but the compiler error is just
saying that the body of your method won't always return a value. If you
could post the body of the method, that would help a lot.
 
Back
Top