BasicKnowledgeCSharp/LessonsAndTasks/Lesson 67 - Методы расширения, extension/MyExtensions.cs
Dvurechensky bf6a7c2b4e 1.1
2025-05-12 02:48:54 +03:00

32 lines
739 B
C#

/*
* Author: Nikolay Dvurechensky
* Site: https://www.dvurechensky.pro/
* Gmail: dvurechenskysoft@gmail.com
* Last Updated: 12 мая 2025 02:47:11
* Version: 1.0.3
*/
using System;
using Students;
namespace Extension
{
static class MyExtensions
{
public static void Print(this DateTime dateTime)
{
Console.WriteLine($"{dateTime.Day} {dateTime.Month} {dateTime.Year}");
}
public static bool IsDayOfWeek(this DateTime dateTime, DayOfWeek dayOfWeek)
{
return dateTime.DayOfWeek == dayOfWeek;
}
public static string GetFullName(this Student student)
{
return student.LastName + " " + student.FirstName;
}
}
}