Implement an interface method with a return value

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!
 
J

Jon Skeet [C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top