using System;namespace PetShop.Model {    /// <summary>
    /// Business entity used to model an order
    /// </summary>
    [Serializable]
    public class OrderInfo {        // Internal member variables
        private int orderId;
        private DateTime date;
        private string userId;
        private CreditCardInfo creditCard;
        private AddressInfo billingAddress;
        private AddressInfo shippingAddress;
        private decimal orderTotal;
        private LineItemInfo[] lineItems;
        private Nullable<int> authorizationNumber;        /// <summary>
        /// Default constructor
        /// This is required by web services serialization mechanism
        /// </summary>
        public OrderInfo() { }                                         为什么OrderInfo()这里是空的,而在下面再写内容呢,为什么不一起写        /// <summary>
        /// Constructor with specified initial values
        /// </summary>
        /// <param name="orderId">Unique identifier</param>
        /// <param name="date">Order date</param>
        /// <param name="userId">User placing order</param>
        /// <param name="creditCard">Credit card used for order</param>
        /// <param name="billing">Billing address for the order</param>
        /// <param name="shipping">Shipping address for the order</param>
        /// <param name="total">Order total value</param>
/// <param name="line">Ordered items</param>
/// <param name="authorization">Credit card authorization number</param>
public OrderInfo(int orderId, DateTime date, string userId, CreditCardInfo creditCard, AddressInfo billing, AddressInfo shipping, decimal total, LineItemInfo[] line, Nullable<int> authorization) {
            this.orderId = orderId;
            this.date = date;
            this.userId = userId;
            this.creditCard = creditCard;
            this.billingAddress = billing;
            this.shippingAddress = shipping;
            this.orderTotal = total;
this.lineItems = line;
this.authorizationNumber = authorization;
        }        // Properties
        public int OrderId {
            get { return orderId; }
            set { orderId = value; }
        }        public DateTime Date {
            get { return date; }
            set { date = value; }
        }        public string UserId {
            get { return userId; }
            set { userId = value; }
        }        public CreditCardInfo CreditCard {                            这句又是什么意思,
            get { return creditCard; }
            set { creditCard = value; }
        }        public AddressInfo BillingAddress {
            get { return billingAddress; }
            set { billingAddress = value; }
        }        public AddressInfo ShippingAddress {
            get { return shippingAddress; }
            set { shippingAddress = value; }
        }        public decimal OrderTotal {
            get { return orderTotal; }
            set { orderTotal = value; }
        }        public LineItemInfo[] LineItems {                                 这句我也看不懂
            get { return lineItems; }
            set { lineItems = value; }
        }        public Nullable<int> AuthorizationNumber {                        <int> 是强致转换吗?
get {return authorizationNumber;}
set {authorizationNumber = value;}
        }
    }
}

解决方案 »

  1.   

     public OrderInfo() { }----构造函数
    public CreditCardInfo CreditCard---------返回CreditCardInfo 类型
    public LineItemInfo[] LineItems ---------返回LineItemInfo[]数组
    Nullable <int> ----------------泛型??
      

  2.   

    Nullable <int> ------空类型
      

  3.   

    /// <summary> 
    /// Default constructor 
    /// This is required by web services serialization mechanism 
    /// </summary> 
    public OrderInfo() { }               为什么OrderInfo()这里是空的,而在下面再写内容呢,为什么不一起写 注释写的很清楚了。这个是web services serialization mechanism需要的,流程需要的是下面带参数的构造函数
    public CreditCardInfo CreditCard {
    public LineItemInfo[] LineItems { 两个属性,返回CreditCardInfo和LineItemInfo[]类型Nullable <int>空属类型,也可以用int?代替,具体看msdn吧
    http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx