コード例 #1
0
        private static void Main(string[] args)
        {
            if (args is null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var person = new PersonBuilder()
                         .Called("John")
                         .WorksAs("Developer")
                         .WithAge(20)
                         .Build();

            Console.WriteLine(person);
        }
コード例 #2
0
 public static PersonBuilder WithAge(this PersonBuilder builder, int age)
 => builder.Do(p => p.Age = age);
コード例 #3
0
 public static PersonBuilder WorksAs(this PersonBuilder builder, string position)
 => builder.Do(p => p.Position = position);