本文整理汇总了C#中Methods.Student类的典型用法代码示例。如果您正苦于以下问题:C# Student类的具体用法?C# Student怎么用?C# Student使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Student类属于Methods命名空间,在下文中一共展示了Student类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main()
{
Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));
Console.WriteLine(Methods.NumberToDigit(5));
Console.WriteLine(Methods.FindMax(5, -1, 3, 2, 14, 2, 3));
Methods.NumberWithPrecision(1.3);
Methods.NumberAsPercentage(0.75);
Methods.NumberRightAligned(2.30);
bool isHorizontal = Methods.IsLineHorizontal(-1, 2.5);
bool isVertical = Methods.IsLineVertical(3, 3);
double distance = Methods.CalculateDistance(3, -1, 3, 2.5);
Console.WriteLine(distance);
Console.WriteLine("Horizontal? : " + isHorizontal);
Console.WriteLine("Vertical? : " + isVertical);
Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17), "From Sofia");
Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 3), "From Vidin, gamer, high results");
Console.WriteLine("{0} older than {1} -> {2}",
peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}
示例2: IsOlderThan
public bool IsOlderThan(Student other)
{
DateTime firstBirthDate = this.BirthDate;
DateTime secondBirthDate = other.BirthDate;
return firstBirthDate < secondBirthDate;
}
示例3: Main
static void Main()
{
Console.WriteLine(CalcTriangleArea(3, 4, 5));
Console.WriteLine(NumberToDigit(5));
Console.WriteLine(FindMax(5, -1, 3, 2, 14, 2, 3));
PrintAsNumber(1.3, "f");
PrintAsNumber(0.75, "%");
PrintAsNumber(2.30, "r");
Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
Console.WriteLine("Horizontal? " + isHorizontal(3, 3));
Console.WriteLine("Vertical? " + isVertical(-1, 2.5));
Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov" };
peter.OtherInfo = "From Sofia, born at 17.03.1992";
Student stella = new Student() { FirstName = "Stella", LastName = "Markova" };
stella.OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993";
Console.WriteLine("{0} older than {1} -> {2}",
peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}
示例4: IsOlderThan
public bool IsOlderThan(Student otherStudent)
{
DateTime firstDate = this.DateOfBirth;
DateTime secondDate = otherStudent.DateOfBirth;
return firstDate < secondDate;
}
示例5: IsOlderThan
/// <summary>
/// Returns if the student is older than another.
/// </summary>
/// <param name="other">The other student.</param>
/// <returns>If older.</returns>
public bool IsOlderThan(Student other)
{
DateTime firstDate = ParseDateFromOtherInfo(this);
DateTime secondDate = ParseDateFromOtherInfo(other);
bool isOlder = firstDate > secondDate;
return isOlder;
}
示例6: Main
public static void Main()
{
Console.WriteLine(ExtensionMethods.CalcTriangleArea(3, 4, 5));
Console.WriteLine(ExtensionMethods.NumberToDigit(5));
Console.WriteLine(ExtensionMethods.FindMax(5, -1, 3, 2, 14, 2, 3));
ExtensionMethods.PrintAsNumber(1.3, "f");
ExtensionMethods.PrintAsNumber(0.75, "%");
ExtensionMethods.PrintAsNumber(2.30, "r");
bool horizontal, vertical;
Console.WriteLine(ExtensionMethods.CalcDistance(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",
OtherInfo = "From Sofia, born at 17.03.1992"
};
Student stella = new Student
{
FirstName = "Stella",
LastName = "Markova",
OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993"
};
Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}
示例7: IsOlderThan
public bool IsOlderThan(Student other)
{
DateTime firstDate = this.GetDateFromInfo(this.OtherInfo);
DateTime secondDate = this.GetDateFromInfo(other.OtherInfo);
return firstDate > secondDate;
}
示例8: IsOlderThan
public bool IsOlderThan(Student other)
{
DateTime firstDate = DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 10));
DateTime secondDate = DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 10));
return firstDate > secondDate;
}
示例9: Main
private static void Main()
{
Console.WriteLine(Methods.CalcTriangleArea(3, 4, 5));
Console.WriteLine(Methods.DigitToString(5));
Console.WriteLine(Methods.FindMax(5, -1, 3, 2, 14, 2, 3));
Methods.FormatNumber(1.3, "f");
Methods.FormatNumber(0.75, "%");
Methods.FormatNumber(2.30, "r");
bool horizontal = Methods.IsHoryzontal(3, -1, 3, 2.5);
bool vertical = Methods.IsVertical(3, -1, 3, 2.5);
Console.WriteLine(Methods.CalcDistance(3, -1, 3, 2.5));
Console.WriteLine("Horizontal? " + horizontal);
Console.WriteLine("Vertical? " + vertical);
Student peter = new Student("Peter", "Ivanov", "1992-03-17");
peter.OtherInfo = "From Sofia";
Student stella = new Student("Stella", "Markova", "1993-03-11");
stella.OtherInfo = "From Vidin, gamer, high results";
Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}
示例10: Main
static void Main()
{
Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));
Console.WriteLine(Methods.DigitToString(5));
Console.WriteLine(Methods.FindMax(5, -1, 3, 2, 14, 2, 3));
Methods.PrintAsFixedPoint(1.3);
Methods.PrintAsPercent(0.75);
Methods.PrintRightWithAlignmentEight(2.30);
Point p1 = new Point(3, -1);
Point p2 = new Point(3, 2.5);
Console.WriteLine("Distance: " + Methods.CalculateDistanceBetweenTwoPoints(p1, p2));
Console.WriteLine("Horizontal? " + Methods.IsSomeLineHorizontal(p1, p2));
Console.WriteLine("Vertical? " + Methods.IsSomeLineVertical(p1, p2));
Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov", };
peter.BirthDate = new DateTime(1992, 03, 17);
peter.OtherInfo = "From Sofia";
Student stella = new Student() { FirstName = "Stella", LastName = "Markova" };
stella.BirthDate = new DateTime(1993, 11, 03);
stella.OtherInfo = "From Vidin, gamer, high results";
Console.WriteLine("{0} older than {1} -> {2}",
peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}
示例11: IsOlderThan
public bool IsOlderThan(Student other)
{
DateTime firstDate = getBirthDate();
DateTime secondDate = getBirthDate();
bool isFirstStudentOlder = (firstDate > secondDate);
return isFirstStudentOlder;
}
示例12: Main
public static void Main()
{
Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));
Console.WriteLine(Methods.NumberToDigitName(5));
Console.WriteLine(Methods.FindMax(5, -1, 3, 2, 14, 2, 3));
Methods.PrintAsNumber(1.3, "f");
Methods.PrintAsNumber(0.75, "%");
Methods.PrintAsNumber(2.30, "r");
bool horizontal = Methods.IsLineHorizontal(-1, 2.5);
bool vertical = Methods.IsLineVertical(3, 3);
Console.WriteLine(Methods.CalculateDistance(3, -1, 3, 2.5));
Console.WriteLine("Horizontal? " + horizontal);
Console.WriteLine("Vertical? " + vertical);
Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17), "From Sofia");
Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 3), "From Vidin, gamer, high results");
Console.WriteLine(
"{0} {1} older than {2} {3} -> {4}",
peter.FirstName,
peter.LastName,
stella.FirstName,
stella.LastName,
peter.IsOlderThan(stella));
}
示例13: Main
static void Main()
{
//StatisticUtils Tests
Console.WriteLine("StatisticUtils Tests");
Console.WriteLine("The Max of the numbers '5, -1, 3, 2, 14, 2, 3' is :{0}", StatisticUtils.Max(5, -1, 3, 2, 14, 2, 3));
Console.WriteLine();
//StringUtils Tests
Console.WriteLine("StringUtils Tests");
Console.WriteLine("The digit 5 to string is: {0}", StringUtils.DigitToString(5));
Console.WriteLine("Different Formats");
Console.WriteLine(StringUtils.FormatNumber(1.3, "f"));
Console.WriteLine(StringUtils.FormatNumber(0.75, "%"));
Console.WriteLine(StringUtils.FormatNumber(2.30, "r"));
Console.WriteLine();
//GeometryUtils Tests
Console.WriteLine("GeometryUtils Tests");
Console.WriteLine("Trinagle with sides '3,4,5' has area: {0}", GeometryUtils.CalcTriangleArea(3, 4, 5));
Console.WriteLine("Distance between the two lines is: {0}", GeometryUtils.CalcDistance(3, -1, 3, 2.5));
Console.WriteLine("Horizontal? " + GeometryUtils.IsHorizontalLine(3, -1, 3.0, 2.5));
Console.WriteLine("Vertical? " + GeometryUtils.IsVerticalLine(3, -1, 3.0, 2.5));
Console.WriteLine();
//Student Tests
Console.WriteLine("Student Tests");
Student peter = new Student(firstName: "Peter", lastName: "Ivanov", dateOfBirth: "17/03/1992");
peter.OtherInfo = "From Sofia.";
Student stella = new Student(firstName: "Stella", lastName:"Markova", dateOfBirth: "03/11/1993");
stella.OtherInfo = "From Vidin, gamer, high results.";
Console.WriteLine("{0} older than {1} -> {2}",
peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}
示例14: IsOlderThan
public bool IsOlderThan(Student other)
{
DateTime firstDate, secondDate;
if (this.OtherInfo == string.Empty || other.OtherInfo == string.Empty)
{
throw new ArgumentException("There is no info for some of the students!");
}
try
{
firstDate = DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 10));
}
catch (FormatException)
{
throw new ArgumentException("The info for the stdent doesn\'t contain birthdate in valid format!");
}
try
{
secondDate = DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 10));
}
catch (FormatException)
{
throw new ArgumentException("The info for the other stdent doesn\'t contain birthdate in valid format!");
}
bool isOlder = firstDate < secondDate;
return isOlder;
}
示例15: Main
public static void Main()
{
Console.WriteLine(CalcTriangleArea(3, 4, 5));
Console.WriteLine(DigitToString(5));
Console.WriteLine(FindMax(5, -1, 3, 2, 14, 2, 3));
PrintAsNumber(1.3, 'f');
PrintAsNumber(0.75, '%');
PrintAsNumber(2.30, 'r');
double x1 = 3;
double y1 = -1;
double x2 = 3;
double y2 = 2.5;
Console.WriteLine(CalcDistance(x1, y1, x2, y2));
bool isHorizontal = AreEqual(y1, y2);
bool isVertical = AreEqual(y1, y2);
Console.WriteLine("Horizontal? " + isHorizontal);
Console.WriteLine("Vertical? " + isVertical);
Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov" };
peter.OtherInfo = "From Sofia, born at 17.03.1992";
Student stella = new Student() { FirstName = "Stella", LastName = "Markova" };
stella.OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993";
Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
}