c# - WCF Service and Inconsistent accessibility -


i cannot understand wrong. mistake:"inconsistent accessibility: return type 'library.servicereference1.author[]' less accessible method 'library.funcs.getauthorslist()'"

//class in dll     [datacontract] public class author {     [datamember]     private string fn, n, p;     [operationcontract]     public string getfamilyname()     {         return fn;     }     [operationcontract]     public string name()     {         return n;     }     [operationcontract]     public string patronymic()     {         return p;     }     public author(string familyname, string name, string patronymic)     {         fn = familyname;         n = name;         p = patronymic;     } } //in service public author[] getauthorslist()     {         return db.singleton.getauthorslist().toarray();     } 

why have [operationcontract] attributes in datacontract class, believe not valid outside of servicecontract decorated class?

if define read properties instead of methods should work

[datacontract] public class author {     [datamember]     private string fn, n, p;      public string familyname     {         { return fn; }     }      public string name     {         { return n; }     }      public string patronymic     {         { return p; }     }      public author(string familyname, string name, string patronymic)     {         fn = familyname;         n = name;         p = patronymic;     } } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -