Wednesday, 15 July 2015

c# - How to use reflection to show properties of Web Service with a List<CustomClass> -


I have successfully applied the answer. However, when I have a list, it does not work when I have participated through this medium, it is here that has returned to me:

  AccountData Result: 'AccountFound' Account List : 'Custom websiteServiceView Test applications. Service Mods Custom Classoptput Data + Data List [] ' 

This item is in the X item and I need to list all the properties for each one.

 < Code> Zero AddPropertiesToTextbox (object output, text box txt) {PropertyInfo [] piData = null;  

Is it the best way for me today? PiData = Utility.GetPublicProperties (Output. GetType ()); Foreach (PropertyInfoPI in PIdata) {if (pi.Name.ToLower ()! = "ExtensionData") {textResult.Text = = string.Format ("{0}: '{1}'", PIIMAM, P GATEVALU ( Output, empty)); TextResult.Text = Environmental.NewLine; Public class output data [[DataConnect] Public class account data {{Database}] public string accountstats {receive; Set; } [Datamember] get public string first name { Set; } [Datamember] public string LastName {get; Set; }} [DataContract] Public Enum AccountData Result [[EnumMember] None, [EnumMember] AccountFound, [EnumMember] NoAccounts} [Database] Public List & lt; AccountData & gt; Receive datalists { Set; } [Datamember] Public AccountData Results Account Data Result {get; Set; }}

You can check the definition of PropertyInfo type

  if (pi.PropertyType.GetGenericTypeDefinition () == Type (list & lt; & gt;)) {// recurse through properties}  

No comments:

Post a Comment