コード例 #1
0
ファイル: Program.cs プロジェクト: mikehowell/examprep-70_483
        public static Order CreateOrder()
        {
            Product p1 = new Product {
                ID = 1, Description = "p2", Price = 9
            };
            Product p2 = new Product {
                ID = 2, Description = "p3", Price = 6
            };

            Order order = new VIPOrder()
            {
                ID          = 4,
                Description = "Order for John Doe. Use the nice giftwrap",
                IsDirty     = true, // will be false when deserializing (ignored XML property)
                OrderLines  = new List <OrderLine>
                {
                    new OrderLine {
                        ID = 5, Amount = 1, Product = p1
                    },
                    new OrderLine {
                        ID = 6, Amount = 10, Product = p2
                    }
                }
            };

            return(order);
        }
コード例 #2
0
        public static Order CreateOrder()
        {
            Product p1 = new Product {
                ID = 1, Description = "p2", Price = 9
            };
            Product p2 = new Product {
                ID = 2, Description = "p3", Price = 6
            };

            Order order = new VIPOrder()
            {
                ID          = 4,
                Description = "Order for John Doe. Use the nice giftwrap",
                OrderLines  = new List <OrderLine>
                {
                    new OrderLine {
                        ID = 5, Amount = 1, Product = p1
                    },
                    new OrderLine {
                        ID = 6, Amount = 10, Product = p2
                    }
                }
            };

            return(order);
        }
コード例 #3
0
        public static Order CreateOrder()
        {
            Product p1 = new Product { ID = 1, Description = "p2", Price = 9 };
            Product p2 = new Product { ID = 2, Description = "p3", Price = 6 };

            Order order = new VIPOrder()
            {
                ID = 4,
                Description = "Order for John Doe. Use the nice giftwrap",
                IsDirty = true, // will be false when deserializing (ignored XML property)
                OrderLines = new List<OrderLine>
                {
                    new OrderLine { ID = 5, Amount = 1, Product = p1 },
                    new OrderLine { ID = 6, Amount = 10, Product = p2 }
                }
            };

            return order;
        }