WCF
What is Generics in case of WCF and use of it ?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AartiRank #2,383 · 594 reputationPosted Nov 16, 2011, 7:43 PM EST
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 LingeRank #785 · 2.9K reputationPosted Nov 16, 2011, 7:44 PM EST
Please check below link.
http://jeffbarnes.net/blog/post/2007/05/10/wcf-serialization-and-generics.aspx
Hope this will help you.
Thanks.