WCF
What is Generics in case of WCF and use of it ?
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.
AartiPosted Nov 17, 2011, 12:43 AM
You cannot define WCF contracts that rely on generic type parameters. Generics are specific to .NET, and using them would violate the service-oriented nature of WCF. However, you can use bounded generic types in your data contracts, as long as you specify the type parameters in the service contract and as long as the specified type parameters have valid data contracts.
Example Using bounded generic types:
[DataContract]
class MyClass
{
[DataMember]
public T MyMember;
}
[ServiceContract]
interface IMyContract
{
[OperationContract]
void MyMethod(MyClass
}
Please refer below link.. I hope it will helop You more.
http://msdn.microsoft.com/en-us/library/aa479866.aspx
Thanks.
Priya LingePosted Nov 17, 2011, 12:44 AM
Please check below link.
http://jeffbarnes.net/blog/post/2007/05/10/wcf-serialization-and-generics.aspx
Hope this will help you.
Thanks.