How to use custom attributes over a web service?

Posted by gfeli on Stack Overflow See other posts from Stack Overflow or by gfeli
Published on 2010-06-16T15:20:08Z Indexed on 2010/06/16 15:22 UTC
Read the original article Hit count: 160

Filed under:
|
|
|

Hi.

I am currently trying to add a custom "column name" to a property in a web service. Here is my class.

public class OrderCost
{ 
    public int OrderNum { get; set; }
    public int OrderLine { get; set; }       
    public int OrderRel { get; set; }
    public DateTime OrderDate { get; set; }
    public string PartNum { get; set; }
    public string Description { get; set; }
    public decimal Qty { get; set; }
    public string SalesUM { get; set; }
    public decimal Cost { get; set; }
    public decimal Price { get; set; }
    public decimal Net { get; set; }
    public decimal Margin { get; set; }
    public string EntryPerson { get; set; }
    public string CustID { get; set; }
    public string Customer { get; set; }
}

Basically I have another class (on the Silverlight side) that loops through all the properties and creates a column for each property. Thing is, I want to use a different name other than the name of the property. For example, I would like to show "Order Number" instead of OrderNum. I have attempted to use custom attributes but that does not seem to work. Is there way I can provide a different name to these properties over a web service with a use of an attribute? Is there another way I can achieve what I am trying to do?

© Stack Overflow or respective owner

Related posts about c#

Related posts about properties