By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,517 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Implement an interface method with a return value

P: n/a
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!
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
dba <br*********@gmail.comwrote:
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.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.