当前位置: 首页>>代码示例>>C#>>正文


C# Customer.ToString方法代码示例

本文整理汇总了C#中Customer.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Customer.ToString方法的具体用法?C# Customer.ToString怎么用?C# Customer.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Customer的用法示例。


在下文中一共展示了Customer.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Customer myCustomer = new Customer(); // value: memory stored in heap
            Console.WriteLine(myCustomer.ToString());

            myCustomer.NewSales(300);
            Console.WriteLine(myCustomer.ToString());

            Customer newCustomer = new Customer("XYZ Company", 500000, "A Contact");
            Console.WriteLine(newCustomer.ToString());

            Console.WriteLine("Read sales of new customer: {0:C}", newCustomer.AnnualSales); // get annualSales

            newCustomer.AnnualSales = 5M;  // set annualSales

            Console.WriteLine("Read sales of new customer: {0:C}", newCustomer.AnnualSales);
        }
开发者ID:reshadn,项目名称:AcademicProgrammingProjects,代码行数:17,代码来源:Test.cs

示例2: CustomerView

        public CustomerView(Customer input)
        {
            Mapper.CreateMap<Customer, CustomerView>();
            Mapper.Map<Customer, CustomerView>(input, this);

            this.created = input.ToString().Replace('T', ' ');
            this.updated = input.updated.ToString().Replace('T', ' ');
        }
开发者ID:JobSystemsAB,项目名称:JobSystems-Angular,代码行数:8,代码来源:CustomerView.cs

示例3: ToString_Test

        public void ToString_Test()
        {
            Customer customer = new Customer();
            IFormatCustomer nameOnly = new NameOnly(customer);
            IFormatCustomer contactPhoneOnly = new ContactPhoneOnly(customer);
            IFormatCustomer revenueOnly = new RevenueOnly(customer);
            IFormatCustomer reverseName = new ReverseDataCustomer(customer);

            string s1 = "Jeffrey Richter ";
            string s2 = "Jeffrey Richter +1(425)555-0100 1000000 ";
            string s3 = "+1(425)555-0100 ";
            string s4 = "rethciR yerffeJ ";

            string r1 = customer.ToString(nameOnly);
            string r2 = customer.ToString(nameOnly, contactPhoneOnly, revenueOnly);
            string r3 = customer.ToString(contactPhoneOnly);
            string r4 = customer.ToString(reverseName);

            Assert.AreEqual(s1,r1);
            Assert.AreEqual(s2,r2);
            Assert.AreEqual(s3,r3);
            Assert.AreEqual(s4,r4);
        }
开发者ID:opolkosergey,项目名称:BSU.ASP.1501.Day2.Opolko,代码行数:23,代码来源:CustomerTests.cs

示例4: Test_StructuralTuple


//.........这里部分代码省略.........
                        Id       = 100L         ,
                        Address1 = "My street"  ,
                        Zip      = "000HOME"    ,
                        City     = "My hometown",
                        Country  = "The Motherland"
                    },
                DeliveryAddress =
                    new Address
                    {
                        Id       = 101L                 ,
                        CareOf   = "My mom"             ,
                        Address1 = "My mom's street"    ,
                        Zip      = "001HOME"            ,
                        City     = "My mom's hometown"  ,
                        Country  = "The Motherland"
                    }

            };

            var three = new Customer
            {
                Id          = 10L           ,
                FirstName   = "A."          ,
                LastName    = "Tester"      ,
                Aliases     = new [] {"Another", "Any"},
                InvoiceAddress =
                    new Address
                    {
                        Id       = 200L         ,
                        Address1 = "My street"  ,
                        Zip      = "000HOME"    ,
                        City     = "My hometown",
                        Country  = "The Motherland"
                    },
                DeliveryAddress =
                    new Address
                    {
                        Id       = 201L                 ,
                        CareOf   = "My mom"             ,
                        Address1 = "My mom's street"    ,
                        Zip      = "001HOME"            ,
                        City     = "My mom's hometown"  ,
                        Country  = "The Motherland"
                    }

            };

            var four = new Customer
            {
                Id          = 20L           ,
                FirstName   = "A."          ,
                LastName    = "Tester"      ,
                Aliases     = new [] {"Another", "Any"},
                InvoiceAddress =
                    new Address
                    {
                        Id       = 200L         ,
                        Address1 = "My street"  ,
                        Zip      = "000HOME"    ,
                        City     = "My hometown",
                        Country  = "The Motherland"
                    },
                DeliveryAddress =
                    new Address
                    {
                        Id       = 201L                 ,
                        CareOf   = "My mom"             ,
                        Address1 = "My mom's street"    ,
                        Zip      = "001HOME"            ,
                        City     = "My mom's hometown"  ,
                        Country  = "The Motherland"
                    }

            };

            var asString = one.ToString ();
            TestFor.Equality (StructuralTupleAsString, asString, "Tuple.ToString must match");

            TestFor.Equality (true  , one.Equals(one)   , "Identical tuples must match");

            TestFor.Equality (true  , one.Equals(two)   , "Structural identical tuples must match");
            TestFor.Equality (true  , two.Equals(one)   , "Structural identical tuples must match");

            TestFor.Equality (false , one.Equals(three) , "Structural non-identical tuples must not match");
            TestFor.Equality (false , three.Equals(one) , "Structural non-identical tuples must not match");

            TestFor.Equality (false , one.Equals(four)  , "Structural non-identical tuples must not match");
            TestFor.Equality (false , four.Equals(one)  , "Structural non-identical tuples must not match");

            TestFor.Equality (true  , one.GetHashCode() == one.GetHashCode()    , "Identical tuples must have same hash code");

            TestFor.Equality (true  , one.GetHashCode() == two.GetHashCode()    , "Structural identical tuples must have same hash code");
            TestFor.Equality (true  , two.GetHashCode() == one.GetHashCode()    , "Structural identical tuples must have same hash code");

            TestFor.Equality (false , one.GetHashCode() == three.GetHashCode()  , "Structural non-identical tuples must not have same hash code");
            TestFor.Equality (false , three.GetHashCode() == one.GetHashCode()  , "Structural non-identical tuples must not have same hash code");

            TestFor.Equality (false , one.GetHashCode() == four.GetHashCode()   , "Structural non-identical tuples must not have same hash code");
            TestFor.Equality (false , four.GetHashCode() == one.GetHashCode()   , "Structural non-identical tuples must not have same hash code");
        }
开发者ID:mrange,项目名称:T4Include,代码行数:101,代码来源:TestsFor_NamedTuple.cs

示例5: CompareTo

 public int CompareTo(Customer other)
     {
         string fullNameThisCustomer = this.ToString();
         string fullNameOtherCustomer = other.ToString();
         if (fullNameThisCustomer.CompareTo(fullNameOtherCustomer) == 0)
         {
             return this.ID.CompareTo(other.ID);
         }
         return fullNameThisCustomer.CompareTo(fullNameOtherCustomer);
     }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:10,代码来源:Customer.cs

示例6: WriteWelcome

 private static void WriteWelcome(Customer customer)
 {
     Console.WriteLine("Welcome To Customer " + customer.ToString() + "'s Store!");
 }
开发者ID:ngm,项目名称:ApleT,代码行数:4,代码来源:Program.cs

示例7: Test_With_Format_Provider

 public string Test_With_Format_Provider(string name, string phoneNumber, decimal revenue, string format,string cultureName)
 {
     CultureInfo ci=new CultureInfo(cultureName);
     Customer customer = new Customer(name, phoneNumber, revenue);
     return customer.ToString(format,ci);
 }
开发者ID:IvanPuchkov,项目名称:BSU.ASP.1501.Day2.Puchkov,代码行数:6,代码来源:Task2CustomerTests.cs

示例8: Test_Without_Format_Provider

 public string Test_Without_Format_Provider(string name, string phoneNumber, decimal revenue,string format)
 {
     Customer customer=new Customer(name,phoneNumber,revenue);
     return customer.ToString(format);
 }
开发者ID:IvanPuchkov,项目名称:BSU.ASP.1501.Day2.Puchkov,代码行数:5,代码来源:Task2CustomerTests.cs


注:本文中的Customer.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。