11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11 ■ WORKING WITH DATA 341ramrameshreddy.blog.comListing 11-2. QuickReturnStockQuote Data Contract with Names Specified[DataContract]public class QuickReturnStockQuote{[DataMember(Name = "TickerSymbol")]internal string Symbol;}[DataMember]internal string CompanyName;[DataMember]internal decimal LastTrade;[DataMember]internal decimal Change;[DataMember]internal decimal PreviousClose;[DataMember(Name = "AverageVolume")]internal decimal AvgVol;[DataMember(Name = "MarketCapital")]internal double MarketCap;[DataMember(Name = "PriceEarningRatio")]internal decimal PERatio;[DataMember(Name = "EarningsPerShare")]internal decimal EPS;[DataMember(Name = "52WkHigh")]internal decimal FiftyTwoWeekHigh;[DataMember(Name = "52WkLow")]internal decimal FiftyTwoWeekLow;ramrameshreddyramrameshreddyData Contract EquivalenceAs stated earlier, both the client and service do not have to have the same type for them to beable to exchange data. However, they need to have the data contracts of both the types presenton either end to be equivalent. Or in other words, they need to have the same namespace andnames. Also, every data member on one side needs to have an equivalent on the other end.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!