Created
March 2, 2021 09:51
-
-
Save syron/676434077b541ee639a42012214239e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Human | |
{ | |
public string Name { get; set; } | |
public DateTime DateTimeOfBirth { get; set; } | |
} | |
public class NewPerson : Human | |
{ | |
public int CalculateAge() | |
{ | |
return 1; | |
} | |
} | |
public static class HumanExtensions | |
{ | |
public static int CalculateAge(this Human human) | |
{ | |
return 7331; | |
} | |
} | |
public static class StringExtensions | |
{ | |
public static string HelloWorld(this string str) | |
{ | |
return "Hello World"; | |
} | |
} | |
public static class HumanHelper | |
{ | |
public static int CalculateAge(Human human) | |
{ | |
return 1337; | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Human person = new Human() { Name = "Ellie", DateTimeOfBirth = DateTime.Parse("2019-12-07 01:37") }; | |
string name = "Robert"; | |
Console.WriteLine(name.HelloWorld()); | |
Console.WriteLine("Age: " + person.CalculateAge()); | |
Console.WriteLine("Age: " + HumanHelper.CalculateAge(person)); | |
List<string> names = new List<string>() { "Robert", "Mayer" }; | |
Console.ReadLine(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment