BasicKnowledgeCSharp/LessonsAndTasks/40_wf_Lesson - Оператор объединения с NULL/Person.cs
Dvurechensky 058c8f2679 1.0
Main
2024-10-05 09:59:53 +03:00

22 lines
639 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace Lesson_40_wf
{
public class Person
{
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string SecondName { get; set; }
public Contacts Contacts { get; set; }
public string GetFullName()
{
return $"Фамилия: {FirstName ?? "нет данных"} | Имя: {MiddleName ?? "нет данных"} | Отчество: {SecondName ?? "нет данных"}";
}
public string GetPhoneNumber()
{
return $"Phone Number: {Contacts?.PhoneNumber ?? "нет данных"}";
}
}
}