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


C# Student.IsOlder方法代码示例

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


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

示例1: Main

        static void Main()
        {
            Console.WriteLine(Calculations.TriangleArea(3, 4, 5));

            Console.WriteLine(Converters.NumberToDigit(5));

            Console.WriteLine(Mathematical.Max(5, -1, 3, 2, 14, 2, 3));

            Console.WriteLine(Formatters.Number(1.3, "f"));
            Console.WriteLine(Formatters.Number(0.75, "%"));
            Console.WriteLine(Formatters.Number(2.30, "r"));

            double x1 = 3;
            double y1 = -1;
            double x2 = 3;
            double y2 = 2.5;
            Console.WriteLine(Calculations.Distance(x1, y1, x2, y2));
            Console.WriteLine("Horizontal? " + (x1 == x2));
            Console.WriteLine("Vertical? " + (y1 == y2));

            DateTime birthDate;
            var peter = new Student() { FirstName = "Peter", LastName = "Ivanov" };
            // "From Sofia, born at 17.03.1992";
            peter.City = "Sofia";
            if (DateTime.TryParse("17.03.1992", out birthDate))
            {
                peter.BirthDate = birthDate;
            }
            else
            {
                throw new FormatException("Invalid Birth Data entered: 17.03.1992");
            }

            var stella = new Student() { FirstName = "Stella", LastName = "Markova" };
            //stella.OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993";
            stella.City = "Vidin";
            if (DateTime.TryParse("03.11.1993", out birthDate))
            {
                stella.BirthDate = birthDate;
            }
            else
            {
                throw new FormatException("Invalid Birth Data entered: 03.11.1993");
            }

            Console.WriteLine("{0} older than {1} -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlder(stella));
        }
开发者ID:nedevny,项目名称:TelerikAkademy,代码行数:48,代码来源:Methods.cs

示例2: Main

        private static void Main()
        {
            Console.WriteLine(CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToText(5));

            Console.WriteLine(FindMax(5, -1, 3, 2, 14, 2, 3));

            StringFormat(1.3, "f");
            StringFormat(0.75, "%");
            StringFormat(2.30, "r");

            bool horizontal, vertical;
            Console.WriteLine(CalculateDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            Student peter = new Student
            {
                FirstName = "Peter",
                LastName = "Ivanov",
                Description = "From Sofia, born at 17.03.1992",
                DateOfBirth = new DateTime(1992, 03, 17)
            };

            Student stella = new Student
            {
                FirstName = "Stella",
                LastName = "Markova",
                Description = "From Vidin, gamer, high results, born at 03.11.1993",
                DateOfBirth = new DateTime(1993, 11, 03)
            };

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlder(stella));
        }
开发者ID:deyantodorov,项目名称:TelerikAcademy,代码行数:35,代码来源:Methods.cs


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