From 6c48a28235cea3774ffc0189973228eb60e246cc Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Thu, 14 Mar 2019 11:19:02 -0400 Subject: [PATCH] fix: Fileinfo -> FileInfo - Icomparable -> IComparable - Switchparameter -> SwitchParameter - Cmdletprovider.Invokeprovider* - Pathintrinsics.Getresolvedproviderpathfrompspath - Getunresolvedproviderpathfrompspath --- .../cmdlet/extending-properties-for-objects.md | 2 +- .../cmdlet/how-to-declare-cmdlet-parameters.md | 4 ++-- ...strongly-encouraged-development-guidelines.md | 16 ++++++++-------- developer/cmdlet/types-of-cmdlet-parameters.md | 6 +++--- ...reating-a-windows-powershell-item-provider.md | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/developer/cmdlet/extending-properties-for-objects.md b/developer/cmdlet/extending-properties-for-objects.md index 1ce1fcef1462..c1fe698ce31a 100644 --- a/developer/cmdlet/extending-properties-for-objects.md +++ b/developer/cmdlet/extending-properties-for-objects.md @@ -77,7 +77,7 @@ In the following example, the `Status` property (whose value is always "Success" A script property defines a property whose value is the output of a script. -In the following example, the `VersionInfo` property is added to the [System.IO.Fileinfo?Displayproperty=Fullname](/dotnet/api/System.IO.FileInfo) type. The [ScriptProperty](http://msdn.microsoft.com/en-us/858a4247-676b-4cc9-9f3e-057109aad350) element defines the extended property as a script property. The [Name](http://msdn.microsoft.com/en-us/b58e9d21-c8c9-49a5-909e-9c1cfc64f873) element specifies the name of the extended property. And, the [GetScriptBlock](http://msdn.microsoft.com/en-us/f3c77546-b98e-4c4e-bbe0-6dfd06696d1c) element specifies the script that generates the property value. (You can also add the [ScriptProperty](http://msdn.microsoft.com/en-us/858a4247-676b-4cc9-9f3e-057109aad350) element to the members of the [MemberSets](http://msdn.microsoft.com/en-us/46a50fb5-e150-4c03-8584-e1b53e4d49e3) element.) +In the following example, the `VersionInfo` property is added to the [System.IO.FileInfo?Displayproperty=Fullname](/dotnet/api/System.IO.FileInfo) type. The [ScriptProperty](http://msdn.microsoft.com/en-us/858a4247-676b-4cc9-9f3e-057109aad350) element defines the extended property as a script property. The [Name](http://msdn.microsoft.com/en-us/b58e9d21-c8c9-49a5-909e-9c1cfc64f873) element specifies the name of the extended property. And, the [GetScriptBlock](http://msdn.microsoft.com/en-us/f3c77546-b98e-4c4e-bbe0-6dfd06696d1c) element specifies the script that generates the property value. (You can also add the [ScriptProperty](http://msdn.microsoft.com/en-us/858a4247-676b-4cc9-9f3e-057109aad350) element to the members of the [MemberSets](http://msdn.microsoft.com/en-us/46a50fb5-e150-4c03-8584-e1b53e4d49e3) element.) ```xml diff --git a/developer/cmdlet/how-to-declare-cmdlet-parameters.md b/developer/cmdlet/how-to-declare-cmdlet-parameters.md index 2a6934a6362b..0a33f1b5116a 100644 --- a/developer/cmdlet/how-to-declare-cmdlet-parameters.md +++ b/developer/cmdlet/how-to-declare-cmdlet-parameters.md @@ -77,7 +77,7 @@ For more information about the Parameter attribute, see [Parameter Attribute Dec ## How to Declare a Switch Parameter -- Define a public property as type [System.Management.Automation.Switchparameter](/dotnet/api/System.Management.Automation.SwitchParameter), and then declare the Parameter attribute. +- Define a public property as type [System.Management.Automation.SwitchParameter](/dotnet/api/System.Management.Automation.SwitchParameter), and then declare the Parameter attribute. ```csharp [Parameter(Position = 1)] @@ -110,7 +110,7 @@ For more information about the Alias attribute, see [Alias Attribute Declaration ## See Also -[System.Management.Automation.Switchparameter](/dotnet/api/System.Management.Automation.SwitchParameter) +[System.Management.Automation.SwitchParameter](/dotnet/api/System.Management.Automation.SwitchParameter) [Parameter Attribute Declaration](./parameter-attribute-declaration.md) diff --git a/developer/cmdlet/strongly-encouraged-development-guidelines.md b/developer/cmdlet/strongly-encouraged-development-guidelines.md index 13b7ad8c2901..a6a1c6570918 100644 --- a/developer/cmdlet/strongly-encouraged-development-guidelines.md +++ b/developer/cmdlet/strongly-encouraged-development-guidelines.md @@ -95,7 +95,7 @@ When the same parameter is used by multiple cmdlets, always use the same paramet #### Parameters That Take True and False -If your parameter takes only `true` and `false`, define the parameter as type [System.Management.Automation.Switchparameter](/dotnet/api/System.Management.Automation.SwitchParameter). A switch parameter is treated as `true` when it is specified in a command. If the parameter is not included in a command, Windows PowerShell considers the value of the parameter to be `false`. Do not define Boolean parameters. +If your parameter takes only `true` and `false`, define the parameter as type [System.Management.Automation.SwitchParameter](/dotnet/api/System.Management.Automation.SwitchParameter). A switch parameter is treated as `true` when it is specified in a command. If the parameter is not included in a command, Windows PowerShell considers the value of the parameter to be `false`. Do not define Boolean parameters. If your parameter needs to differentiate between 3 values: $true, $false and "unspecified", then define a parameter of type Nullable\. The need for a 3rd, "unspecified" value typically occurs when the cmdlet can modify a Boolean property of an object. In this case "unspecified" means to not change the current value of the property. @@ -168,15 +168,15 @@ If your cmdlet allows the user to specify a file or a data source, it should def If the data that the cmdlet reads or writes has to be a file, the cmdlet should accept Windows PowerShell path input, and the cmdlet should use the [System.Management.Automation.Sessionstate.Path](/dotnet/api/System.Management.Automation.SessionState.Path) property to translate the Windows PowerShell paths into paths that the file system recognizes. The specific mechanisms include the following methods: -- [System.Management.Automation.PSCmdlet.Getresolvedproviderpathfrompspath](/dotnet/api/System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath) +- [System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath](/dotnet/api/System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath) -- [System.Management.Automation.PSCmdlet.Getunresolvedproviderpathfrompspath](/dotnet/api/System.Management.Automation.PSCmdlet.GetUnresolvedProviderPathFromPSPath) +- [System.Management.Automation.PSCmdlet.GetUnresolvedProviderPathFromPSPath](/dotnet/api/System.Management.Automation.PSCmdlet.GetUnresolvedProviderPathFromPSPath) -- [System.Management.Automation.Pathintrinsics.Getresolvedproviderpathfrompspath](/dotnet/api/System.Management.Automation.PathIntrinsics.GetResolvedProviderPathFromPSPath) +- [System.Management.Automation.PathIntrinsics.GetResolvedProviderPathFromPSPath](/dotnet/api/System.Management.Automation.PathIntrinsics.GetResolvedProviderPathFromPSPath) -- [System.Management.Automation.Pathintrinsics.Getunresolvedproviderpathfrompspath](/dotnet/api/System.Management.Automation.PathIntrinsics.GetUnresolvedProviderPathFromPSPath) +- [System.Management.Automation.PathIntrinsics.GetUnresolvedProviderPathFromPSPath](/dotnet/api/System.Management.Automation.PathIntrinsics.GetUnresolvedProviderPathFromPSPath) -If the data that the cmdlet reads or writes is only a set of strings instead of a file, the cmdlet should use the provider content information (`Content` member) to read and write. This information is obtained from the [System.Management.Automation.Provider.Cmdletprovider.Invokeprovider*](/dotnet/api/System.Management.Automation.Provider.CmdletProvider.InvokeProvider) property. These mechanisms allow other data stores to participate in the reading and writing of data. +If the data that the cmdlet reads or writes is only a set of strings instead of a file, the cmdlet should use the provider content information (`Content` member) to read and write. This information is obtained from the [System.Management.Automation.Provider.CmdletProvider.InvokeProvider](/dotnet/api/System.Management.Automation.Provider.CmdletProvider.InvokeProvider) property. These mechanisms allow other data stores to participate in the reading and writing of data. #### Support Wildcard Characters @@ -200,11 +200,11 @@ If you are designing an object for a cmdlet, ensure that its members map directl Preexisting .NET Framework objects that are returned by cmdlets are frequently missing some important or convenient members that are needed by the script developer or user. These missing members can be particularly important for display and for creating the correct member names so that the object can be correctly passed to the pipeline. Create a custom Types.ps1xml file to document these required members. When you create this file, we recommend the following naming convention: **.Types.ps1xml. -For example, you could add a `Mode` script property to the [System.IO.Fileinfo](/dotnet/api/System.IO.FileInfo) type to display the attributes of a file more clearly. Additionally, you could add a `Count` alias property to the [System.Array](/dotnet/api/System.Array) type to allow the consistent use of that property name (instead of `Length`). +For example, you could add a `Mode` script property to the [System.IO.FileInfo](/dotnet/api/System.IO.FileInfo) type to display the attributes of a file more clearly. Additionally, you could add a `Count` alias property to the [System.Array](/dotnet/api/System.Array) type to allow the consistent use of that property name (instead of `Length`). ##### Implement the IComparable Interface -Implement a [System.Icomparable](/dotnet/api/System.IComparable) interface on all output objects. This allows the output objects to be easily piped to various sorting and analysis cmdlets. +Implement a [System.IComparable](/dotnet/api/System.IComparable) interface on all output objects. This allows the output objects to be easily piped to various sorting and analysis cmdlets. ##### Update Display Information diff --git a/developer/cmdlet/types-of-cmdlet-parameters.md b/developer/cmdlet/types-of-cmdlet-parameters.md index 3e42fa650845..f0cb8d7052fa 100644 --- a/developer/cmdlet/types-of-cmdlet-parameters.md +++ b/developer/cmdlet/types-of-cmdlet-parameters.md @@ -85,13 +85,13 @@ private string userName; ## Switch Parameters -Windows PowerShell provides a [System.Management.Automation.Switchparameter](/dotnet/api/System.Management.Automation.SwitchParameter) type that allows you to define a parameter whose value is automatically set to `false` if the parameter is not specified when the cmdlet is called. Whenever possible, use switch parameters in place of Boolean parameters. +Windows PowerShell provides a [System.Management.Automation.SwitchParameter](/dotnet/api/System.Management.Automation.SwitchParameter) type that allows you to define a parameter whose value is automatically set to `false` if the parameter is not specified when the cmdlet is called. Whenever possible, use switch parameters in place of Boolean parameters. Consider the following sample. By default, several Windows PowerShell cmdlets do not pass an output object down the pipeline. However, these cmdlets have a `PassThru` switch parameter that overrides the default behavior. If the `PassThru` parameter is specified when these cmdlets are called, the cmdlet returns an output object to the pipeline. -If you need the parameter to have a default value of `true` when the parameter is not specified in the call, consider reversing the sense of the parameter. For sample, instead of setting the parameter attribute to a Boolean value of `true`, declare the property as the [System.Management.Automation.Switchparameter](/dotnet/api/System.Management.Automation.SwitchParameter) type, and then set the default value of the parameter to `false`. +If you need the parameter to have a default value of `true` when the parameter is not specified in the call, consider reversing the sense of the parameter. For sample, instead of setting the parameter attribute to a Boolean value of `true`, declare the property as the [System.Management.Automation.SwitchParameter](/dotnet/api/System.Management.Automation.SwitchParameter) type, and then set the default value of the parameter to `false`. -To define a switch parameter, declare the property as the [System.Management.Automation.Switchparameter](/dotnet/api/System.Management.Automation.SwitchParameter) type, as shown in the following sample. +To define a switch parameter, declare the property as the [System.Management.Automation.SwitchParameter](/dotnet/api/System.Management.Automation.SwitchParameter) type, as shown in the following sample. ```csharp [Parameter(Position = 1)] diff --git a/developer/prog-guide/creating-a-windows-powershell-item-provider.md b/developer/prog-guide/creating-a-windows-powershell-item-provider.md index 066a4038708f..257db9ce37bb 100644 --- a/developer/prog-guide/creating-a-windows-powershell-item-provider.md +++ b/developer/prog-guide/creating-a-windows-powershell-item-provider.md @@ -247,7 +247,7 @@ The sample item provider defines a DatabaseTableInfo.GetTables method that retur ### DatabaseRowInfo Class -This item provider defines the DatabaseRowInfo helper class that represents a row in a table of the database. This class is similar to the [System.IO.Fileinfo](/dotnet/api/System.IO.FileInfo) class. +This item provider defines the DatabaseRowInfo helper class that represents a row in a table of the database. This class is similar to the [System.IO.FileInfo](/dotnet/api/System.IO.FileInfo) class. The sample provider defines a DatabaseRowInfo.GetRows method to return a collection of row information objects for the specified table. This method includes a try/catch block to trap exceptions. Any errors will result in no row information.