Page 1 of 1

Passing Generic class of type Enum fails in WCF(SOAP)

Posted: Mon Jan 11, 2016 5:22 pm
by mikeda
Hi,

If generic class includes empty initialized string data member(string unit),
Exception is thrown in JavaScript run time.
if unit is initialized non empty value, it works fine.

Code: Select all

[DataContract]
    public class CompositeType<T> where T : struct
    {
        T val;
        [DataMember]
        public T Value {
            get { return val; }
            set { val = value; }
        }
        string unit = string.Empty;
        [DataMember]
        public string Unit { get { return unit; } set { unit = value; } }
    }