Use read-only auto-implemented properties (#13507)

* Autofix RCS1170: Use read-only auto-implemented property
This commit is contained in:
xtqqczze 2020-09-02 04:11:16 +01:00 committed by GitHub
parent 4e21101ba5
commit 859890374a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 322 additions and 431 deletions

View file

@ -95,11 +95,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// return value could be null
/// </remarks>
/// </summary>
internal virtual string ComputerName
{
get;
private set;
}
internal virtual string ComputerName { get; }
/// <summary>
/// <para>
@ -109,11 +105,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// return value could be null
/// </remarks>
/// </summary>
internal virtual CimInstance TargetCimInstance
{
get;
private set;
}
internal virtual CimInstance TargetCimInstance { get; }
}
#endregion

View file

@ -26,13 +26,13 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
_privateData = privateData;
}
public string CmdletizationClassName { get; private set; }
public string CmdletizationClassName { get; }
public string CmdletizationClassVersion { get; private set; }
public string CmdletizationClassVersion { get; }
public Version CmdletizationModuleVersion { get; private set; }
public Version CmdletizationModuleVersion { get; }
public bool SupportsShouldProcess { get; private set; }
public bool SupportsShouldProcess { get; }
private readonly IDictionary<string, string> _privateData;

View file

@ -81,21 +81,21 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
}
}
public CimCmdletDefinitionContext CmdletDefinitionContext { get; private set; }
public CimCmdletDefinitionContext CmdletDefinitionContext { get; }
public InvocationInfo CmdletInvocationInfo { get; private set; }
public InvocationInfo CmdletInvocationInfo { get; }
public MshCommandRuntime.ShouldProcessPossibleOptimization ShouldProcessOptimization { get; private set; }
public MshCommandRuntime.ShouldProcessPossibleOptimization ShouldProcessOptimization { get; }
public ActionPreference ErrorActionPreference { get; private set; }
public ActionPreference ErrorActionPreference { get; }
public ActionPreference WarningActionPreference { get; private set; }
public ActionPreference WarningActionPreference { get; }
public ActionPreference VerboseActionPreference { get; private set; }
public ActionPreference VerboseActionPreference { get; }
public ActionPreference DebugActionPreference { get; private set; }
public ActionPreference DebugActionPreference { get; }
public string NamespaceOverride { get; private set; }
public string NamespaceOverride { get; }
public bool IsRunningInBackground
{

View file

@ -22,11 +22,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
this.TargetObject = targetObject ?? this.ClassName;
}
public CimCmdletInvocationContext CmdletInvocationContext { get; private set; }
public CimCmdletInvocationContext CmdletInvocationContext { get; }
public CimSession Session { get; private set; }
public CimSession Session { get; }
public object TargetObject { get; private set; }
public object TargetObject { get; }
public string ClassName
{

View file

@ -29,7 +29,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
internal readonly Dictionary<string, object> queryOptions = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
internal ClientSideQuery ClientSideQuery { get; private set; }
internal ClientSideQuery ClientSideQuery { get; }
internal CimQuery()
{

View file

@ -55,11 +55,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
}
}
public string PropertyName { get; private set; }
public string PropertyName { get; }
public object PropertyValue { get; private set; }
public object PropertyValue { get; }
public Func<string, string, string> ErrorMessageGenerator { get; private set; }
public Func<string, string, string> ErrorMessageGenerator { get; }
private static string GetErrorMessageForNotFound(string queryDescription, string className)
{

View file

@ -45,12 +45,12 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Name of the computer that is restarting.
/// </summary>
public string ComputerName { get; private set; }
public string ComputerName { get; }
/// <summary>
/// The timeout value specified by the user. It indicates the seconds to wait before timeout.
/// </summary>
public int Timeout { get; private set; }
public int Timeout { get; }
/// <summary>
/// Construct a RestartComputerTimeoutException.

View file

@ -26,11 +26,7 @@ namespace Microsoft.PowerShell.Commands
/// debugger is currently attached. The script or command will remain stopped until
/// a debugger is attached to debug the breakpoint.
/// </summary>
public bool Enabled
{
get;
private set;
}
public bool Enabled { get; }
/// <summary>
/// When true this property will cause any running command or script in the Runspace
@ -38,29 +34,17 @@ namespace Microsoft.PowerShell.Commands
/// script or command will remain stopped until a debugger is attached to debug the
/// current stop point.
/// </summary>
public bool BreakAll
{
get;
private set;
}
public bool BreakAll { get; }
/// <summary>
/// Name of runspace for which the options apply.
/// </summary>
public string RunspaceName
{
get;
private set;
}
public string RunspaceName { get; }
/// <summary>
/// Local Id of runspace for which the options apply.
/// </summary>
public int RunspaceId
{
get;
private set;
}
public int RunspaceId { get; }
#endregion

View file

@ -116,31 +116,31 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension
/// <summary>
/// A string representing the definition of the command.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// A string representing module the command belongs to.
/// </summary>
public string ModuleName { get; private set; }
public string ModuleName { get; }
/// <summary>
/// A reference to the module the command came from.
/// </summary>
public ShowCommandModuleInfo Module { get; private set; }
public ShowCommandModuleInfo Module { get; }
/// <summary>
/// An enumeration of the command types this command belongs to.
/// </summary>
public CommandTypes CommandType { get; private set; }
public CommandTypes CommandType { get; }
/// <summary>
/// A string representing the definition of the command.
/// </summary>
public string Definition { get; private set; }
public string Definition { get; }
/// <summary>
/// A string representing the definition of the command.
/// </summary>
public ICollection<ShowCommandParameterSetInfo> ParameterSets { get; private set; }
public ICollection<ShowCommandParameterSetInfo> ParameterSets { get; }
}
}

View file

@ -46,6 +46,6 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension
/// <summary>
/// Gets the name of this module.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
}
}

View file

@ -68,37 +68,37 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension
/// <summary>
/// Gets the name of the parameter.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <remarks>
/// True if the parameter is dynamic, or false otherwise.
/// </remarks>
public bool IsMandatory { get; private set; }
public bool IsMandatory { get; }
/// <summary>
/// Gets whether the parameter can take values from the incoming pipeline object.
/// </summary>
public bool ValueFromPipeline { get; private set; }
public bool ValueFromPipeline { get; }
/// <summary>
/// Gets the type of the parameter.
/// </summary>
public ShowCommandParameterType ParameterType { get; private set; }
public ShowCommandParameterType ParameterType { get; }
/// <summary>
/// The possible values of this parameter.
/// </summary>
public IList<string> ValidParamSetValues { get; private set; }
public IList<string> ValidParamSetValues { get; }
/// <summary>
/// Gets whether the parameter has a parameter set.
/// </summary>
public bool HasParameterSet { get; private set; }
public bool HasParameterSet { get; }
/// <summary>
/// Gets the position in which the parameter can be specified on the command line
/// if not named. If the returned value is int.MinValue then the parameter must be named.
/// </summary>
public int Position { get; private set; }
public int Position { get; }
}
}

View file

@ -53,16 +53,16 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension
/// <summary>
/// Gets the name of the parameter set.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Gets whether the parameter set is the default parameter set.
/// </summary>
public bool IsDefault { get; private set; }
public bool IsDefault { get; }
/// <summary>
/// Gets the parameter information for the parameters in this parameter set.
/// </summary>
public ICollection<ShowCommandParameterInfo> Parameters { get; private set; }
public ICollection<ShowCommandParameterInfo> Parameters { get; }
}
}

View file

@ -74,32 +74,32 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension
/// <summary>
/// The full name of the outermost type.
/// </summary>
public string FullName { get; private set; }
public string FullName { get; }
/// <summary>
/// Whether or not this type is an enum.
/// </summary>
public bool IsEnum { get; private set; }
public bool IsEnum { get; }
/// <summary>
/// Whether or not this type is an dictionary.
/// </summary>
public bool ImplementsDictionary { get; private set; }
public bool ImplementsDictionary { get; }
/// <summary>
/// Whether or not this enum has a flag attribute.
/// </summary>
public bool HasFlagAttribute { get; private set; }
public bool HasFlagAttribute { get; }
/// <summary>
/// Whether or not this type is an array type.
/// </summary>
public bool IsArray { get; private set; }
public bool IsArray { get; }
/// <summary>
/// Gets the inner type, if this corresponds to an array type.
/// </summary>
public ShowCommandParameterType ElementType { get; private set; }
public ShowCommandParameterType ElementType { get; }
/// <summary>
/// Whether or not this type is a string.
@ -148,6 +148,6 @@ namespace Microsoft.PowerShell.Commands.ShowCommandExtension
/// <summary>
/// If this is an enum value, return the list of potential values.
/// </summary>
public ArrayList EnumValues { get; private set; }
public ArrayList EnumValues { get; }
}
}

View file

@ -211,12 +211,12 @@ namespace Microsoft.PowerShell.Commands
/// Gets underlying bytes stored in the collection.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public byte[] Bytes { get; private set; }
public byte[] Bytes { get; }
/// <summary>
/// Gets the path of the file whose contents are wrapped in the ByteCollection.
/// </summary>
public string Path { get; private set; }
public string Path { get; }
/// <summary>
/// Gets the hexadecimal representation of the <see cref="Offset64"/> value.
@ -226,7 +226,7 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Gets the type of the input objects used to create the <see cref="ByteCollection"/>.
/// </summary>
public string Label { get; private set; }
public string Label { get; }
private const int BytesPerLine = 16;

View file

@ -873,7 +873,7 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// HTTP error response.
/// </summary>
public HttpResponseMessage Response { get; private set; }
public HttpResponseMessage Response { get; }
}
/// <summary>

View file

@ -13,22 +13,22 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Gets or private sets the Id property.
/// </summary>
public string Id { get; private set; }
public string Id { get; }
/// <summary>
/// Gets or private sets the Method property.
/// </summary>
public string Method { get; private set; }
public string Method { get; }
/// <summary>
/// Gets or private sets the Action property.
/// </summary>
public string Action { get; private set; }
public string Action { get; }
/// <summary>
/// Gets or private sets the Fields property.
/// </summary>
public Dictionary<string, string> Fields { get; private set; }
public Dictionary<string, string> Fields { get; }
/// <summary>
/// Constructor for FormObject.

View file

@ -41,6 +41,6 @@ namespace Microsoft.PowerShell.MarkdownRender
/// <summary>
/// Gets the current escape sequences.
/// </summary>
public VT100EscapeSequences EscapeSequences { get; private set; }
public VT100EscapeSequences EscapeSequences { get; }
}
}

View file

@ -994,10 +994,7 @@ namespace Microsoft.PowerShell.Commands
/// Parameter '-CentralAccessPolicy' is not supported in OneCore powershell,
/// because function 'LsaQueryCAPs' is not available in OneCoreUAP and NanoServer.
/// </summary>
private string CentralAccessPolicy
{
get; set;
}
private string CentralAccessPolicy { get; }
#else
private string centralAccessPolicy;

View file

@ -672,10 +672,10 @@ namespace System.Management.Automation
public sealed class FormatViewDefinition
{
/// <summary>Name of the formatting view as defined in the formatting file</summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>The control defined by this formatting view can be one of table, list, wide, or custom</summary>
public PSControl Control { get; private set; }
public PSControl Control { get; }
/// <summary>instance id of the original view this will be used to distinguish two views with the same name and control types</summary>
internal Guid InstanceId { get; set; }

View file

@ -16,7 +16,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
/// </summary>
internal sealed class FormatObjectDeserializer
{
internal TerminatingErrorContext TerminatingErrorContext { get; private set; }
internal TerminatingErrorContext TerminatingErrorContext { get; }
/// <summary>
/// Expansion of TAB character to the following string.

View file

@ -492,7 +492,7 @@ namespace System.Management.Automation
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public PSTypeName[] Type { get; private set; }
public PSTypeName[] Type { get; }
/// <summary>
/// Attributes implemented by a provider can use:
@ -752,7 +752,7 @@ namespace System.Management.Automation
{
/// <summary>
/// </summary>
public string PSTypeName { get; private set; }
public string PSTypeName { get; }
/// <summary>
/// Creates a new PSTypeNameAttribute.

View file

@ -3879,7 +3879,7 @@ namespace System.Management.Automation
/// Gets or sets the command that this parameter binder controller
/// will bind parameters to.
/// </summary>
internal Cmdlet Command { get; private set; }
internal Cmdlet Command { get; }
#region DefaultParameterBindingStructures

View file

@ -38,7 +38,7 @@ namespace System.Management.Automation.InteropServices
public Delegate Delegate { get; set; }
public bool WrapArgs { get; private set; }
public bool WrapArgs { get; }
public object? Invoke(object[] args)
{

View file

@ -24,10 +24,10 @@ namespace System.Management.Automation
{
/// <summary/>
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public Type Type { get; private set; }
public Type Type { get; }
/// <summary/>
public ScriptBlock ScriptBlock { get; private set; }
public ScriptBlock ScriptBlock { get; }
/// <param name="type">The type must implement <see cref="IArgumentCompleter"/> and have a default constructor.</param>
public ArgumentCompleterAttribute(Type type)

View file

@ -782,12 +782,12 @@ namespace System.Management.Automation.Language
/// <summary>
/// The command element associated with the exception.
/// </summary>
public CommandElementAst CommandElement { get; private set; }
public CommandElementAst CommandElement { get; }
/// <summary>
/// The ParameterBindingException that this command element caused.
/// </summary>
public ParameterBindingException BindingException { get; private set; }
public ParameterBindingException BindingException { get; }
}
#region "PseudoBindingInfo"

View file

@ -889,7 +889,7 @@ namespace System.Management.Automation
/// <summary>
/// When a type is defined by PowerShell, the ast for that type.
/// </summary>
public TypeDefinitionAst TypeDefinitionAst { get; private set; }
public TypeDefinitionAst TypeDefinitionAst { get; }
private bool _typeWasCalculated;

View file

@ -193,7 +193,7 @@ namespace System.Management.Automation
/// <summary>
/// Gets the name of the parameter.
/// </summary>
internal string Name { get; private set; }
internal string Name { get; }
/// <summary>
/// The PSTypeName from a PSTypeNameAttribute.
@ -203,38 +203,38 @@ namespace System.Management.Automation
/// <summary>
/// Gets the Type information of the attribute.
/// </summary>
internal Type Type { get; private set; }
internal Type Type { get; }
/// <summary>
/// Gets the Type information of the attribute.
/// </summary>
internal Type DeclaringType { get; private set; }
internal Type DeclaringType { get; }
/// <summary>
/// Gets whether the parameter is a dynamic parameter or not.
/// </summary>
internal bool IsDynamic { get; private set; }
internal bool IsDynamic { get; }
/// <summary>
/// Gets the parameter collection type information.
/// </summary>
internal ParameterCollectionTypeInformation CollectionTypeInformation { get; private set; }
internal ParameterCollectionTypeInformation CollectionTypeInformation { get; }
/// <summary>
/// A collection of the attributes found on the member. The attributes have been compiled into
/// a format that easier to digest by the metadata processor.
/// </summary>
internal Collection<Attribute> CompiledAttributes { get; private set; }
internal Collection<Attribute> CompiledAttributes { get; }
/// <summary>
/// Gets the collection of data generation attributes on this parameter.
/// </summary>
internal ArgumentTransformationAttribute[] ArgumentTransformationAttributes { get; private set; }
internal ArgumentTransformationAttribute[] ArgumentTransformationAttributes { get; }
/// <summary>
/// Gets the collection of data validation attributes on this parameter.
/// </summary>
internal ValidateArgumentsAttribute[] ValidationAttributes { get; private set; }
internal ValidateArgumentsAttribute[] ValidationAttributes { get; }
/// <summary>
/// Get and private set the obsolete attribute on this parameter.
@ -299,12 +299,12 @@ namespace System.Management.Automation
/// <summary>
/// A dictionary of the parameter sets and the parameter set specific data for this parameter.
/// </summary>
internal Dictionary<string, ParameterSetSpecificMetadata> ParameterSetData { get; private set; }
internal Dictionary<string, ParameterSetSpecificMetadata> ParameterSetData { get; }
/// <summary>
/// The alias names for this parameter.
/// </summary>
internal string[] Aliases { get; private set; }
internal string[] Aliases { get; }
/// <summary>
/// Determines if this parameter takes pipeline input for any of the specified
@ -675,11 +675,11 @@ namespace System.Management.Automation
/// <summary>
/// The collection type of the parameter.
/// </summary>
internal ParameterCollectionType ParameterCollectionType { get; private set; }
internal ParameterCollectionType ParameterCollectionType { get; }
/// <summary>
/// The type of the elements in the collection.
/// </summary>
internal Type ElementType { get; private set; }
internal Type ElementType { get; }
}
}

View file

@ -57,7 +57,7 @@ namespace System.Management.Automation
/// <summary>
/// Name of the DSC Resource.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Gets or sets resource type name.

View file

@ -2011,7 +2011,7 @@ namespace System.Management.Automation
/// <summary>
/// Gets whether the event should be unregistered.
/// </summary>
internal bool AutoUnregister { get; private set; }
internal bool AutoUnregister { get; }
/// <summary>
/// Indicate how many new should be added to the action queue.

View file

@ -657,12 +657,12 @@ namespace System.Management.Automation
/// <summary>
/// Gets the compiled command parameter for the association.
/// </summary>
internal CompiledCommandParameter Parameter { get; private set; }
internal CompiledCommandParameter Parameter { get; }
/// <summary>
/// Gets the type of binder that the compiled command parameter should be bound with.
/// </summary>
internal ParameterBinderAssociation BinderAssociation { get; private set; }
internal ParameterBinderAssociation BinderAssociation { get; }
public override string ToString()
{

View file

@ -23,7 +23,7 @@ namespace System.Management.Automation
/// <summary>
/// Name of the class.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Collection of members of the class.
@ -72,16 +72,16 @@ namespace System.Management.Automation
/// <summary>
/// Gets or sets name of the member.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Gets or sets type of the member.
/// </summary>
public string TypeName { get; private set; }
public string TypeName { get; }
/// <summary>
/// Default value of the Field.
/// </summary>
public string DefaultValue { get; private set; }
public string DefaultValue { get; }
}
}

View file

@ -1985,7 +1985,7 @@ namespace System.Management.Automation
private static readonly IDictionary s_emptyUsingParameters = new ReadOnlyDictionary<object, object>(new Dictionary<object, object>());
public List<string> BoundPositionally { get; private set; }
public List<string> BoundPositionally { get; }
internal IDictionary ImplicitUsingParameters { get; set; }
}

View file

@ -56,7 +56,7 @@ namespace System.Management.Automation
/// <summary>
/// Gets the parameter binder for the command.
/// </summary>
internal ParameterBinderBase DefaultParameterBinder { get; private set; }
internal ParameterBinderBase DefaultParameterBinder { get; }
/// <summary>
/// The invocation information about the code being run.

View file

@ -72,12 +72,12 @@ namespace System.Management.Automation
/// <summary>
/// Gets the name of the parameter set.
/// </summary>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Gets whether the parameter set is the default parameter set.
/// </summary>
public bool IsDefault { get; private set; }
public bool IsDefault { get; }
/// <summary>
/// Gets the parameter information for the parameters in this parameter set.

View file

@ -68,7 +68,7 @@ namespace System.Management.Automation
/// <summary>
/// Gets the ScriptBlock that represents the implementation of the script.
/// </summary>
public ScriptBlock ScriptBlock { get; private set; }
public ScriptBlock ScriptBlock { get; }
// Path

View file

@ -20,12 +20,12 @@ namespace System.Management.Automation.Subsystem
/// <summary>
/// The kind of a concrete subsystem.
/// </summary>
public SubsystemKind Kind { get; private set; }
public SubsystemKind Kind { get; }
/// <summary>
/// The type of a concrete subsystem.
/// </summary>
public Type SubsystemType { get; private set; }
public Type SubsystemType { get; }
/// <summary>
/// Indicate whether the subsystem allows to unregister an implementation.

View file

@ -1936,18 +1936,18 @@ namespace System.Management.Automation.Runspaces
this.TypeName = type.FullName;
}
internal bool fromTypesXmlFile { get; private set; }
internal bool fromTypesXmlFile { get; }
/// <summary>
/// Get the TypeName.
/// </summary>
public string TypeName { get; private set; }
public string TypeName { get; }
/// <summary>
/// Get the members of this TypeData instance.
/// The Key of the dictionary is the member's name, and the Value is a TypeMemberData instance.
/// </summary>
public Dictionary<string, TypeMemberData> Members { get; private set; }
public Dictionary<string, TypeMemberData> Members { get; }
/// <summary>
/// The type converter.
@ -1966,7 +1966,7 @@ namespace System.Management.Automation.Runspaces
#region StandardMember
internal Dictionary<string, TypeMemberData> StandardMembers { get; private set; }
internal Dictionary<string, TypeMemberData> StandardMembers { get; }
/// <summary>
/// The serializationMethod.
@ -2725,7 +2725,7 @@ namespace System.Management.Automation.Runspaces
/// <summary>
/// The referenced properties.
/// </summary>
public Collection<string> ReferencedProperties { get; private set; }
public Collection<string> ReferencedProperties { get; }
/// <summary>
/// The PropertySet name.
@ -2777,7 +2777,7 @@ namespace System.Management.Automation.Runspaces
/// <summary>
/// The members of the MemberSet.
/// </summary>
public Collection<TypeMemberData> Members { get; private set; }
public Collection<TypeMemberData> Members { get; }
/// <summary>
/// Set true if the member is supposed to be hidden.

View file

@ -2032,11 +2032,7 @@ namespace System.Management.Automation
internal class ImplicitRemotingBatchingNotSupportedException : Exception
{
internal string ErrorId
{
get;
private set;
}
internal string ErrorId { get; }
internal ImplicitRemotingBatchingNotSupportedException(string errorId) : base(
ParserStrings.ImplicitRemotingPipelineBatchingNotSupported)

View file

@ -20,7 +20,7 @@ namespace System.Management.Automation
/// <summary>
/// The action to take when the breakpoint is hit.
/// </summary>
public ScriptBlock Action { get; private set; }
public ScriptBlock Action { get; }
/// <summary>
/// Gets whether this breakpoint is enabled.
@ -40,7 +40,7 @@ namespace System.Management.Automation
/// <summary>
/// This breakpoint's Id.
/// </summary>
public int Id { get; private set; }
public int Id { get; }
/// <summary>
/// True if breakpoint is set on a script, false if the breakpoint is not scoped.
@ -53,7 +53,7 @@ namespace System.Management.Automation
/// <summary>
/// The script this breakpoint is on, or null if the breakpoint is not scoped.
/// </summary>
public string Script { get; private set; }
public string Script { get; }
#endregion properties
@ -191,9 +191,9 @@ namespace System.Management.Automation
/// <summary>
/// Which command this breakpoint is on.
/// </summary>
public string Command { get; private set; }
public string Command { get; }
internal WildcardPattern CommandPattern { get; private set; }
internal WildcardPattern CommandPattern { get; }
/// <summary>
/// Gets a string representation of this breakpoint.
@ -312,12 +312,12 @@ namespace System.Management.Automation
/// <summary>
/// The access mode to trigger this variable breakpoint on.
/// </summary>
public VariableAccessMode AccessMode { get; private set; }
public VariableAccessMode AccessMode { get; }
/// <summary>
/// Which variable this breakpoint is on.
/// </summary>
public string Variable { get; private set; }
public string Variable { get; }
/// <summary>
/// Gets the string representation of this breakpoint.
@ -415,12 +415,12 @@ namespace System.Management.Automation
/// <summary>
/// Which column this breakpoint is on.
/// </summary>
public int Column { get; private set; }
public int Column { get; }
/// <summary>
/// Which line this breakpoint is on.
/// </summary>
public int Line { get; private set; }
public int Line { get; }
/// <summary>
/// Gets a string representation of this breakpoint.

View file

@ -95,7 +95,7 @@ namespace System.Management.Automation
/// Note there may be more than one breakpoint on the same object (line, variable, command). A single event is
/// raised for all these breakpoints.
/// </remarks>
public ReadOnlyCollection<Breakpoint> Breakpoints { get; private set; }
public ReadOnlyCollection<Breakpoint> Breakpoints { get; }
/// <summary>
/// This property must be set in the event handler to indicate the debugger what it should do next.
@ -155,17 +155,17 @@ namespace System.Management.Automation
/// <summary>
/// Gets the breakpoint that was updated.
/// </summary>
public Breakpoint Breakpoint { get; private set; }
public Breakpoint Breakpoint { get; }
/// <summary>
/// Gets the type of update.
/// </summary>
public BreakpointUpdateType UpdateType { get; private set; }
public BreakpointUpdateType UpdateType { get; }
/// <summary>
/// Gets the current breakpoint count.
/// </summary>
public int BreakpointCount { get; private set; }
public int BreakpointCount { get; }
};
#region PSJobStartEventArgs
@ -178,29 +178,17 @@ namespace System.Management.Automation
/// <summary>
/// Job to be started.
/// </summary>
public Job Job
{
get;
private set;
}
public Job Job { get; }
/// <summary>
/// Job debugger.
/// </summary>
public Debugger Debugger
{
get;
private set;
}
public Debugger Debugger { get; }
/// <summary>
/// Job is run asynchronously.
/// </summary>
public bool IsAsync
{
get;
private set;
}
public bool IsAsync { get; }
/// <summary>
/// Constructor.
@ -226,11 +214,7 @@ namespace System.Management.Automation
public sealed class StartRunspaceDebugProcessingEventArgs : EventArgs
{
/// <summary> The runspace to process </summary>
public Runspace Runspace
{
get;
private set;
}
public Runspace Runspace { get; }
/// <summary>
/// When set to true this will cause PowerShell to process this runspace debug session through its
@ -262,11 +246,7 @@ namespace System.Management.Automation
/// <summary>
/// The runspace where internal debug processing has ended.
/// </summary>
public Runspace Runspace
{
get;
private set;
}
public Runspace Runspace { get; }
/// <summary>
/// Constructor.
@ -4196,11 +4176,7 @@ namespace System.Management.Automation
/// <summary>
/// Type of runspace being monitored for debugging.
/// </summary>
public PSMonitorRunspaceType RunspaceType
{
get;
private set;
}
public PSMonitorRunspaceType RunspaceType { get; }
/// <summary>
/// Unique parent debugger identifier for monitored runspace.
@ -5018,11 +4994,7 @@ namespace System.Management.Automation
/// True if debugger evaluated command. Otherwise evaluation was
/// performed by PowerShell.
/// </summary>
public bool EvaluatedByDebugger
{
get;
private set;
}
public bool EvaluatedByDebugger { get; }
#endregion
@ -5488,18 +5460,18 @@ namespace System.Management.Automation
/// <summary>
/// InvocationInfo of the command currently being executed.
/// </summary>
public InvocationInfo InvocationInfo { get; private set; }
public InvocationInfo InvocationInfo { get; }
/// <summary>
/// If not empty, indicates that the execution was suspended because one or more breakpoints
/// were hit. Otherwise, the execution was suspended as part of a step operation.
/// </summary>
public Breakpoint[] Breakpoints { get; private set; }
public Breakpoint[] Breakpoints { get; }
/// <summary>
/// Gets the object that triggered the current dynamic breakpoint.
/// </summary>
public object Trigger { get; private set; }
public object Trigger { get; }
}
#endregion
@ -5567,13 +5539,13 @@ namespace System.Management.Automation
/// <summary>
/// The InvocationInfo of the command.
/// </summary>
public InvocationInfo InvocationInfo { get; private set; }
public InvocationInfo InvocationInfo { get; }
/// <summary>
/// The position information for the current position in the frame. Null if the frame is not
/// associated with a script.
/// </summary>
public IScriptExtent Position { get; private set; }
public IScriptExtent Position { get; }
/// <summary>
/// The name of the function associated with this frame.
@ -5765,12 +5737,12 @@ namespace System.Management.Automation.Internal
/// <summary>
/// Created Runspace.
/// </summary>
public Runspace Runspace { get; private set; }
public Runspace Runspace { get; }
/// <summary>
/// Type of runspace for monitoring.
/// </summary>
public PSMonitorRunspaceType RunspaceType { get; private set; }
public PSMonitorRunspaceType RunspaceType { get; }
/// <summary>
/// Nested debugger wrapper for runspace debugger.
@ -5876,7 +5848,7 @@ namespace System.Management.Automation.Internal
/// <summary>
/// PowerShell command to run. Can be null.
/// </summary>
public PowerShell Command { get; private set; }
public PowerShell Command { get; }
/// <summary>
/// Unique parent debugger identifier.

View file

@ -758,11 +758,7 @@ namespace System.Management.Automation.Runspaces
/// <summary>
/// Gets the Runspace Id.
/// </summary>
public int Id
{
get;
private set;
}
public int Id { get; }
/// <summary>
/// Returns protocol version that the remote server uses for PS remoting.

View file

@ -1048,11 +1048,7 @@ namespace System.Management.Automation.Host
PromptText = "PS>";
}
internal List<TranscriptionOption> Transcripts
{
get;
private set;
}
internal List<TranscriptionOption> Transcripts { get; }
internal TranscriptionOption SystemTranscript { get; set; }
internal string CommandBeingIgnored { get; set; }
@ -1092,12 +1088,12 @@ namespace System.Management.Automation.Host
/// <summary>
/// Any output to log for this transcript.
/// </summary>
internal List<string> OutputToLog { get; private set; }
internal List<string> OutputToLog { get; }
/// <summary>
/// Any output currently being logged for this transcript.
/// </summary>
internal List<string> OutputBeingLogged { get; private set; }
internal List<string> OutputBeingLogged { get; }
/// <summary>
/// Whether to include time stamp / command separators in

View file

@ -32,7 +32,7 @@ namespace System.Management.Automation.Interpreter
{
internal sealed class LightLambdaCompileEventArgs : EventArgs
{
public Delegate Compiled { get; private set; }
public Delegate Compiled { get; }
internal LightLambdaCompileEventArgs(Delegate compiled)
{

View file

@ -190,7 +190,7 @@ namespace System.Management.Automation
this.RequestingCommandProcessor = requestingCommand.Context.CurrentCommandProcessor;
}
public CommandProcessorBase RequestingCommandProcessor { get; private set; }
public CommandProcessorBase RequestingCommandProcessor { get; }
}
#endregion Flow Control Exceptions
@ -1725,15 +1725,9 @@ namespace System.Management.Automation
get { return Current; }
}
internal char LowerBound
{
get; private set;
}
internal char LowerBound { get; }
internal char UpperBound
{
get; private set;
}
internal char UpperBound { get; }
public char Current
{

View file

@ -239,7 +239,7 @@ namespace System.Management.Automation.Language
this.Root = root;
}
private Ast Root { get; set; }
private Ast Root { get; }
internal AstVisitAction CheckParent(Ast ast)
{

View file

@ -2206,11 +2206,11 @@ namespace System.Management.Automation.Language
this.ContinueLabel = continueLabel;
}
internal string Label { get; private set; }
internal string Label { get; }
internal LabelTarget ContinueLabel { get; private set; }
internal LabelTarget ContinueLabel { get; }
internal LabelTarget BreakLabel { get; private set; }
internal LabelTarget BreakLabel { get; }
}
private LabelTarget _returnTarget;

View file

@ -53,9 +53,9 @@ namespace System.Management.Automation.Language
/// </summary>
internal class AmbiguousTypeException : InvalidCastException
{
public string[] Candidates { private set; get; }
public string[] Candidates { get; }
public TypeName TypeName { private set; get; }
public TypeName TypeName { get; }
public AmbiguousTypeException(TypeName typeName, IEnumerable<string> candidates)
{

View file

@ -31,7 +31,7 @@ namespace System.Management.Automation.Language
public bool Automatic { get; set; }
public bool PreferenceVariable { get; set; }
public bool Assigned { get; set; }
public List<Ast> AssociatedAsts { get; private set; }
public List<Ast> AssociatedAsts { get; }
}
internal class FindAllVariablesVisitor : AstVisitor
@ -340,11 +340,11 @@ namespace System.Management.Automation.Language
this.ContinueTarget = continueTarget;
}
internal string Label { get; private set; }
internal string Label { get; }
internal Block BreakTarget { get; private set; }
internal Block BreakTarget { get; }
internal Block ContinueTarget { get; private set; }
internal Block ContinueTarget { get; }
}
private class Block

File diff suppressed because it is too large Load diff

View file

@ -1349,7 +1349,7 @@ namespace System.Management.Automation.Language
/// <summary>
/// The full details of the variable path.
/// </summary>
public VariablePath VariablePath { get; private set; }
public VariablePath VariablePath { get; }
internal override string ToDebugString(int indent)
{
@ -1503,12 +1503,12 @@ namespace System.Management.Automation.Language
/// <summary>
/// The stream being redirected.
/// </summary>
public RedirectionStream FromStream { get; private set; }
public RedirectionStream FromStream { get; }
/// <summary>
/// The stream being written to.
/// </summary>
public RedirectionStream ToStream { get; private set; }
public RedirectionStream ToStream { get; }
}
/// <summary>
@ -1526,12 +1526,12 @@ namespace System.Management.Automation.Language
/// <summary>
/// The stream being redirected.
/// </summary>
public RedirectionStream FromStream { get; private set; }
public RedirectionStream FromStream { get; }
/// <summary>
/// True if the redirection should append the file rather than create a new file.
/// </summary>
public bool Append { get; private set; }
public bool Append { get; }
}
internal class UnscannedSubExprToken : StringLiteralToken
@ -1542,6 +1542,6 @@ namespace System.Management.Automation.Language
this.SkippedCharOffsets = skippedCharOffsets;
}
internal BitArray SkippedCharOffsets { get; private set; }
internal BitArray SkippedCharOffsets { get; }
}
}

View file

@ -371,7 +371,7 @@ namespace System.Management.Automation
InstanceId = instanceId;
}
internal int Id { get; private set; }
internal int Id { get; }
internal Guid InstanceId { get; private set; }
}
@ -4517,11 +4517,7 @@ namespace System.Management.Automation
internal class OutputProcessingStateEventArgs : EventArgs
{
internal bool ProcessingOutput
{
get;
private set;
}
internal bool ProcessingOutput { get; }
internal OutputProcessingStateEventArgs(bool processingOutput)
{

View file

@ -747,38 +747,22 @@ namespace Microsoft.PowerShell.Commands
/// <summary>
/// Name of process.
/// </summary>
public string ProcessName
{
get;
private set;
}
public string ProcessName { get; }
/// <summary>
/// Id of process.
/// </summary>
public int ProcessId
{
get;
private set;
}
public int ProcessId { get; }
/// <summary>
/// Name of PowerShell AppDomain in process.
/// </summary>
public string AppDomainName
{
get;
private set;
}
public string AppDomainName { get; }
/// <summary>
/// Main window title of the process.
/// </summary>
public string MainWindowTitle
{
get;
private set;
}
public string MainWindowTitle { get; }
#endregion

View file

@ -301,20 +301,12 @@ namespace System.Management.Automation.Remoting
/// Exception reason for listener end event. Can be null
/// which indicates listener thread end is not due to an error.
/// </summary>
public Exception Reason
{
private set;
get;
}
public Exception Reason { get; }
/// <summary>
/// True if listener should be restarted after ending.
/// </summary>
public bool RestartListener
{
private set;
get;
}
public bool RestartListener { get; }
#endregion

View file

@ -17,7 +17,7 @@ namespace System.Management.Automation.Remoting
{
private readonly HashSet<string> _supportedCommands = new HashSet<string>();
internal Version PSVersion { get; private set; }
internal Version PSVersion { get; }
/// <summary>
/// Initializes a new instance of the <see cref="RemoteDebuggingCapability"/> class.

View file

@ -340,7 +340,7 @@ namespace System.Management.Automation
internal bool HasLogged { get; set; }
internal bool SkipLogging { get; set; }
internal bool IsFilter { get; private set; }
internal bool IsFilter { get; }
internal bool IsProductCode
{

View file

@ -858,7 +858,7 @@ namespace System.Management.Automation
this.FromStream = from;
}
internal RedirectionStream FromStream { get; private set; }
internal RedirectionStream FromStream { get; }
internal abstract void Bind(PipelineProcessor pipelineProcessor, CommandProcessorBase commandProcessor, ExecutionContext context);
@ -1039,9 +1039,9 @@ namespace System.Management.Automation
File);
}
internal string File { get; private set; }
internal string File { get; }
internal bool Appending { get; private set; }
internal bool Appending { get; }
private PipelineProcessor PipelineProcessor { get; set; }

View file

@ -161,7 +161,7 @@ namespace System.Management.Automation
/// <summary>
/// The script that is being bound to.
/// </summary>
internal ScriptBlock Script { get; private set; }
internal ScriptBlock Script { get; }
internal SessionStateScope LocalScope { get; set; }

View file

@ -63,7 +63,7 @@ namespace System.Management.Automation
/// <summary>
/// Holds the set of parameters that were not bound to any argument (i.e $args)
/// </summary>
internal List<object> DollarArgs { get; private set; }
internal List<object> DollarArgs { get; }
/// <summary>
/// Binds the command line parameters for shell functions/filters/scripts/scriptblocks.

View file

@ -79,13 +79,13 @@ namespace Microsoft.PowerShell.Telemetry
private const string _telemetryFailure = "TELEMETRY_FAILURE";
// Telemetry client to be reused when we start sending more telemetry
private static TelemetryClient s_telemetryClient { get; set; }
private static TelemetryClient s_telemetryClient { get; }
// the unique identifier for the user, when we start we
private static string s_uniqueUserIdentifier { get; set; }
private static string s_uniqueUserIdentifier { get; }
// the session identifier
private static string s_sessionId { get; set; }
private static string s_sessionId { get; }
// private semaphore to determine whether we sent the startup telemetry event
private static int s_startupEventSent = 0;

View file

@ -63,19 +63,11 @@ namespace System.Management.Automation.Tracing
}
/// <summary> Gets whether the event is successfully written </summary>
public bool Success
{
get;
private set;
}
public bool Success { get; }
/// <summary> Gets payload in the event </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public object[] Payload
{
get;
private set;
}
public object[] Payload { get; }
/// <summary>
/// Creates a new instance of EtwEventArgs class.

View file

@ -11,5 +11,5 @@ public class TestPriorityAttribute : Attribute
Priority = priority;
}
public int Priority { get; private set; }
public int Priority { get; }
}