MegaBites-AI/Windows-powershell
0308
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System.Collections.Generic;5using System.Collections.ObjectModel;6 7namespace System.Management.Automation8{9 /// <summary>10 /// Contains a PS Class information.11 /// </summary>12 public sealed class PSClassInfo13 {14 /// <summary>15 /// Initializes a new instance of the PSClassInfo class.16 /// </summary>17 /// <param name="name">Name of the PS Class.</param>18 internal PSClassInfo(string name)19 {20 this.Name = name;21 }22 23 /// <summary>24 /// Name of the class.25 /// </summary>26 public string Name { get; }27 28 /// <summary>29 /// Collection of members of the class.30 /// </summary>31 public ReadOnlyCollection<PSClassMemberInfo> Members { get; private set; }32 33 /// <summary>34 /// Updates members of the class.35 /// </summary>36 /// <param name="members">Updated members.</param>37 public void UpdateMembers(IList<PSClassMemberInfo> members)38 {39 if (members != null)40 this.Members = new ReadOnlyCollection<PSClassMemberInfo>(members);41 }42 43 /// <summary>44 /// Module in which the class is implemented in.45 /// </summary>46 public PSModuleInfo Module { get; internal set; }47 48 /// <summary>49 /// Gets the help file path for the cmdlet.50 /// </summary>51 public string HelpFile { get; internal set; } = string.Empty;52 }53 54 /// <summary>55 /// Contains a class field information.56 /// </summary>57 public sealed class PSClassMemberInfo58 {59 /// <summary>60 /// Initializes a new instance of the PSClassMemberInfo class.61 /// </summary>62 internal PSClassMemberInfo(string name, string memberType, string defaultValue)63 {64 ArgumentException.ThrowIfNullOrEmpty(name);65 66 this.Name = name;67 this.TypeName = memberType;68 this.DefaultValue = defaultValue;69 }70 71 /// <summary>72 /// Gets or sets name of the member.73 /// </summary>74 public string Name { get; }75 76 /// <summary>77 /// Gets or sets type of the member.78 /// </summary>79 public string TypeName { get; }80 81 /// <summary>82 /// Default value of the Field.83 /// </summary>84 public string DefaultValue { get; }85 }86}87 