Can we use abstract class instead of interface in wcf as servicecontract?
Can we use abstract class instead of interface in wcf as servicecontract? I have searched a lot on internet but didnt find proper answer.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
C# CornerPosted Jun 30, 2011, 5:55 AM
VulpesPosted May 23, 2011, 5:19 AM
DRISHTYPosted May 23, 2011, 5:00 AM
Sam HobbsPosted May 22, 2011, 9:20 PM
interface InterfaceBase
{
void Implemented() // error: interface members cannot have a definition
{
Console.WriteLine();
}
void Unimplemented();
}
abstract class classAbstract
{
void Implemented()
{
Console.WriteLine();
}
abstract public void Unimplemented();
}
You can't compile it; you will get an error. I am sorry that I do not know much about WCF and servicecontracts but I assume that a servicecontract cannot have a class with a method that is implemeted. I hope someone will correct me if I am wrong.