HashSet in WCF

I am using HashSet in my WCF interface

[ServiceContract]
public interface IwcfServerSync
{
    [OperationContract]
    void Test(HashSet<int> someHashSet);
}

When I create a service link, the HashSet turns into int [].

I added ServiceKnownType:

[ServiceKnownType(typeof(System.Collections.Generic.HashSet<int>))]

and tried some kind of configuration, but could not change it.

if I change it hardcoded, everything works, but it's really annoying to change it every time I update my help.

Am I probably doing something wrong, any pointers or ideas?

+3
source share
1 answer

, . IDE (svcutil /collectionType), API. , . , , - xml ( , ) - - :

<items>
   <item ...>...</item>
   <item ...>...</item>
   <item ...>...</item>
</items>

- ( ) (T[]), a List<T>, a HashSet<T> a MyFunkyCollection<T>.

, (.. ), , SOA/mex. , - , IDE , - (svcutil /reference).


IDE... (dll), ( dll ) ( ). (.svc). VS2008, - - : IwcfServerSync , , HashSet<T> ..

+4

Source: https://habr.com/ru/post/1708025/


All Articles