Advertisement
Combreal

classConstructor.ps1

Mar 2nd, 2024 (edited)
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Add-Type -TypeDefinition @'
  2. public class DbzCharacter {
  3.    public int Id { get; set; }
  4.    public string Name{ get; set; }
  5.    public int SuperSaiyanLevel { get; set; }
  6.    public string SpecialMove{ get; set; }
  7.  
  8.    public DbzCharacter(int id, string name, int superSaiyanLevel, string specialMove) {
  9.    this.Id = id;
  10.    this.Name = name;
  11.    this.SuperSaiyanLevel = superSaiyanLevel;
  12.    this.SpecialMove = specialMove;
  13.    }
  14. }
  15. '@
  16.  
  17. $Person2 = [DbzCharacter]::new(1, "Goku", 3, "Kamehameha")
  18. $Person3 = [DbzCharacter]::new(2, "Tony", 99, "Montana")
  19.  
  20. $Person2
  21. $Person3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement