Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace revision
- {
- internal class PersonBuilder
- {
- private int _id;
- private string _name;
- private string _phone_Number;
- private string _address;
- private DateTime _birthDate;
- public PersonBuilder SetId(int id) { this._id = id; return this; }
- public PersonBuilder SetName(string name) { this._name = name; return this; }
- public PersonBuilder SetPhoneNumber(string phoneNumber) { this._phone_Number = phoneNumber; return this; }
- public PersonBuilder SetAddress(string address) { this._address = address; return this; }
- public PersonBuilder SetBirthDate(DateTime birthDate) { this._birthDate = birthDate; return this; }
- // we postpone the intialization
- public Person Builder()
- {
- return new Person(_id , _name , _phone_Number , _address , _birthDate);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement