diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs index d3c61582de..242e5b1c5c 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs @@ -470,7 +470,7 @@ namespace Microsoft.PowerShell.Commands } // Get the -FromMember template for a given language - private string GetMethodTemplate(Language language) + private static string GetMethodTemplate(Language language) { switch (language) { @@ -486,7 +486,7 @@ namespace Microsoft.PowerShell.Commands } // Get the -FromMember namespace template for a given language - private string GetNamespaceTemplate(Language language) + private static string GetNamespaceTemplate(Language language) { switch (language) { @@ -502,7 +502,7 @@ namespace Microsoft.PowerShell.Commands } // Get the -FromMember namespace template for a given language - private string GetUsingTemplate(Language language) + private static string GetUsingTemplate(Language language) { switch (language) { @@ -840,7 +840,7 @@ namespace Microsoft.PowerShell.Commands // However, this does give us a massive usability improvement, as users can just say // Add-Type -AssemblyName Forms (instead of System.Windows.Forms) // This is just long, not unmaintainable. - private Assembly LoadAssemblyHelper(string assemblyName) + private static Assembly LoadAssemblyHelper(string assemblyName) { Assembly loadedAssembly = null; @@ -898,7 +898,7 @@ namespace Microsoft.PowerShell.Commands #region SourceCodeProcessing - private OutputKind OutputAssemblyTypeToOutputKind(OutputAssemblyType outputType) + private static OutputKind OutputAssemblyTypeToOutputKind(OutputAssemblyType outputType) { switch (outputType) { @@ -1136,7 +1136,7 @@ namespace Microsoft.PowerShell.Commands } } - private void CacheNewTypes(ConcurrentBag newTypes) + private static void CacheNewTypes(ConcurrentBag newTypes) { foreach (var typeName in newTypes) { @@ -1266,7 +1266,7 @@ namespace Microsoft.PowerShell.Commands } } - private string BuildErrorMessage(Diagnostic diagnisticRecord) + private static string BuildErrorMessage(Diagnostic diagnisticRecord) { var location = diagnisticRecord.Location; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs index 1562697975..03a83bd447 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertFrom-SddlString.cs @@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.Commands private AccessRightTypeNames _type; private bool _isTypeSet = false; - private string ConvertToNTAccount(SecurityIdentifier securityIdentifier) + private static string ConvertToNTAccount(SecurityIdentifier securityIdentifier) { try { @@ -55,7 +55,7 @@ namespace Microsoft.PowerShell.Commands } } - private List GetApplicableAccessRights(int accessMask, AccessRightTypeNames? typeName) + private static List GetApplicableAccessRights(int accessMask, AccessRightTypeNames? typeName) { List typesToExamine = new List(); List foundAccessRightNames = new List(); @@ -93,7 +93,7 @@ namespace Microsoft.PowerShell.Commands return foundAccessRightNames; } - private Type GetRealAccessRightType(AccessRightTypeNames typeName) + private static Type GetRealAccessRightType(AccessRightTypeNames typeName) { switch (typeName) { @@ -114,7 +114,7 @@ namespace Microsoft.PowerShell.Commands } } - private string[] ConvertAccessControlListToStrings(CommonAcl acl, AccessRightTypeNames? typeName) + private static string[] ConvertAccessControlListToStrings(CommonAcl acl, AccessRightTypeNames? typeName) { if (acl == null || acl.Count == 0) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs index 5f3a3e3c14..e9ca7df9e3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ConvertTo-Html.cs @@ -607,7 +607,7 @@ namespace Microsoft.PowerShell.Commands /// /// To write the Property name. /// - private void WritePropertyName(StringBuilder Listtag, MshParameter p) + private static void WritePropertyName(StringBuilder Listtag, MshParameter p) { // for writing the property name string label = p.GetEntry(ConvertHTMLParameterDefinitionKeys.LabelEntryKey) as string; @@ -652,7 +652,7 @@ namespace Microsoft.PowerShell.Commands /// /// To write the Table header for the object property names. /// - private void WriteTableHeader(StringBuilder THtag, List resolvedNameMshParameters) + private static void WriteTableHeader(StringBuilder THtag, List resolvedNameMshParameters) { // write the property names foreach (MshParameter p in resolvedNameMshParameters) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs index 92d67d134d..2f5f8f6b7b 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs @@ -441,7 +441,7 @@ namespace System.Management.Automation /// /// /// - private void GetKnownContainerTypeInfo( + private static void GetKnownContainerTypeInfo( object source, out ContainerType ct, out IDictionary dictionary, out IEnumerable enumerable) { Dbg.Assert(source != null, "caller should validate the parameter"); @@ -675,7 +675,7 @@ namespace System.Management.Automation /// /// /// - private bool PSObjectHasNotes(PSObject source) + private static bool PSObjectHasNotes(PSObject source) { if (source.InstanceMembers != null && source.InstanceMembers.Count > 0) { @@ -954,7 +954,7 @@ namespace System.Management.Automation /// /// string value to use for serializing this PSObject. /// - private string GetStringFromPSObject(PSObject source) + private static string GetStringFromPSObject(PSObject source) { Dbg.Assert(source != null, "caller should have validated the information"); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs index 1a560a0010..8111a721b9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs @@ -549,7 +549,7 @@ namespace Microsoft.PowerShell.Commands } } - private void SetLocalMode(System.Management.Automation.Debugger debugger, bool localMode) + private static void SetLocalMode(System.Management.Automation.Debugger debugger, bool localMode) { ServerRemoteDebugger remoteDebugger = debugger as ServerRemoteDebugger; if (remoteDebugger != null) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs index dc967889e6..0c2481b8ee 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs @@ -191,7 +191,7 @@ namespace Microsoft.PowerShell.Commands /// /// None. /// This method updates "activeAssociationList" instance property. - private void FilterActiveAssociationList(List activeAssociationList) + private static void FilterActiveAssociationList(List activeAssociationList) { // we got a valid set of properties from the default property set // make sure we do not have too many properties diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs index 03525eca55..26109ca710 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs @@ -222,7 +222,7 @@ namespace Microsoft.PowerShell.Commands /// Returns the items in the input list that match an item in the filter array according to /// the given selection criterion. /// - private List Filter(List input, T[] filter, FilterSelector selector) + private static List Filter(List input, T[] filter, FilterSelector selector) { List output = new List(); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs index d84c866ad7..3569b2e4dc 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRandomCommand.cs @@ -217,7 +217,7 @@ namespace Microsoft.PowerShell.Commands [Parameter(ParameterSetName = RandomNumberParameterSet)] public object Minimum { get; set; } - private bool IsInt(object o) + private static bool IsInt(object o) { if (o == null || o is int) { @@ -227,7 +227,7 @@ namespace Microsoft.PowerShell.Commands return false; } - private bool IsInt64(object o) + private static bool IsInt64(object o) { if (o == null || o is Int64) { @@ -237,7 +237,7 @@ namespace Microsoft.PowerShell.Commands return false; } - private object ProcessOperand(object o) + private static object ProcessOperand(object o) { if (o == null) { @@ -257,7 +257,7 @@ namespace Microsoft.PowerShell.Commands return baseObject; } - private double ConvertToDouble(object o, double defaultIfNull) + private static double ConvertToDouble(object o, double defaultIfNull) { if (o == null) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs index 41202adce2..d14ffbfc2e 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs @@ -1306,7 +1306,7 @@ namespace Microsoft.PowerShell.Commands parameterType); } - private bool IsProxyForCmdlet(Dictionary parameters) + private static bool IsProxyForCmdlet(Dictionary parameters) { // we are not sending CmdletBinding/DefaultParameterSet over the wire anymore // we need to infer IsProxyForCmdlet from presence of all common parameters @@ -1355,7 +1355,7 @@ namespace Microsoft.PowerShell.Commands return new CommandMetadata( name: name, commandType: commandType, - isProxyForCmdlet: this.IsProxyForCmdlet(parameters), + isProxyForCmdlet: IsProxyForCmdlet(parameters), defaultParameterSetName: ParameterAttribute.AllParameterSets, supportsShouldProcess: false, confirmImpact: ConfirmImpact.None, @@ -1365,7 +1365,7 @@ namespace Microsoft.PowerShell.Commands parameters: parameters); } - private int GetCommandTypePriority(CommandTypes commandType) + private static int GetCommandTypePriority(CommandTypes commandType) { switch (commandType) { @@ -1434,8 +1434,8 @@ namespace Microsoft.PowerShell.Commands CommandMetadata previousCommandWithSameName; if (name2commandMetadata.TryGetValue(commandMetadata.Name, out previousCommandWithSameName)) { - int previousCommandPriority = this.GetCommandTypePriority(previousCommandWithSameName.WrappedCommandType); - int currentCommandPriority = this.GetCommandTypePriority(commandMetadata.WrappedCommandType); + int previousCommandPriority = GetCommandTypePriority(previousCommandWithSameName.WrappedCommandType); + int currentCommandPriority = GetCommandTypePriority(commandMetadata.WrappedCommandType); if (previousCommandPriority < currentCommandPriority) { return; @@ -1975,7 +1975,7 @@ namespace Microsoft.PowerShell.Commands return null; } - private string EscapeFunctionNameForRemoteHelp(string name) + private static string EscapeFunctionNameForRemoteHelp(string name) { if (name == null) { @@ -2000,7 +2000,7 @@ namespace Microsoft.PowerShell.Commands ############################################################################## "; - private void GenerateSectionSeparator(TextWriter writer) + private static void GenerateSectionSeparator(TextWriter writer) { writer.Write(SectionSeparator); } @@ -2135,7 +2135,7 @@ function Write-PSImplicitRemotingMessage } "; - private void GenerateHelperFunctionsWriteMessage(TextWriter writer) + private static void GenerateHelperFunctionsWriteMessage(TextWriter writer) { if (writer == null) { @@ -2190,7 +2190,7 @@ function Set-PSImplicitRemotingSession if ($PSSessionOverride) {{ Set-PSImplicitRemotingSession $PSSessionOverride }} "; - private void GenerateHelperFunctionsSetImplicitRunspace(TextWriter writer) + private static void GenerateHelperFunctionsSetImplicitRunspace(TextWriter writer) { if (writer == null) { @@ -2767,7 +2767,7 @@ function Get-PSImplicitRemotingClientSideParameters } "; - private void GenerateHelperFunctionsClientSideParameters(TextWriter writer) + private static void GenerateHelperFunctionsClientSideParameters(TextWriter writer) { if (writer == null) { @@ -2781,12 +2781,12 @@ function Get-PSImplicitRemotingClientSideParameters private void GenerateHelperFunctions(TextWriter writer) { - this.GenerateSectionSeparator(writer); - this.GenerateHelperFunctionsWriteMessage(writer); + GenerateSectionSeparator(writer); + GenerateHelperFunctionsWriteMessage(writer); this.GenerateHelperFunctionsGetSessionOption(writer); - this.GenerateHelperFunctionsSetImplicitRunspace(writer); + GenerateHelperFunctionsSetImplicitRunspace(writer); this.GenerateHelperFunctionsGetImplicitRunspace(writer); - this.GenerateHelperFunctionsClientSideParameters(writer); + GenerateHelperFunctionsClientSideParameters(writer); } #endregion @@ -2846,7 +2846,7 @@ function Get-PSImplicitRemotingClientSideParameters }} "; - private void GenerateCommandProxy(TextWriter writer, CommandMetadata commandMetadata) + private static void GenerateCommandProxy(TextWriter writer, CommandMetadata commandMetadata) { if (writer == null) { @@ -2854,7 +2854,7 @@ function Get-PSImplicitRemotingClientSideParameters } string functionNameForString = CodeGeneration.EscapeSingleQuotedStringContent(commandMetadata.Name); - string functionNameForHelp = this.EscapeFunctionNameForRemoteHelp(commandMetadata.Name); + string functionNameForHelp = EscapeFunctionNameForRemoteHelp(commandMetadata.Name); writer.Write( CommandProxyTemplate, /* 0 */ functionNameForString, @@ -2868,7 +2868,7 @@ function Get-PSImplicitRemotingClientSideParameters /* 8 */ commandMetadata.WrappedAnyCmdlet); } - private void GenerateCommandProxy(TextWriter writer, IEnumerable listOfCommandMetadata) + private static void GenerateCommandProxy(TextWriter writer, IEnumerable listOfCommandMetadata) { if (writer == null) { @@ -2880,7 +2880,7 @@ function Get-PSImplicitRemotingClientSideParameters throw PSTraceSource.NewArgumentNullException(nameof(listOfCommandMetadata)); } - this.GenerateSectionSeparator(writer); + GenerateSectionSeparator(writer); foreach (CommandMetadata commandMetadata in listOfCommandMetadata) { GenerateCommandProxy(writer, commandMetadata); @@ -2895,7 +2895,7 @@ function Get-PSImplicitRemotingClientSideParameters & $script:ExportModuleMember -Function {0} "; - private void GenerateExportDeclaration(TextWriter writer, IEnumerable listOfCommandMetadata) + private static void GenerateExportDeclaration(TextWriter writer, IEnumerable listOfCommandMetadata) { if (writer == null) { @@ -2907,14 +2907,14 @@ function Get-PSImplicitRemotingClientSideParameters throw PSTraceSource.NewArgumentNullException(nameof(listOfCommandMetadata)); } - this.GenerateSectionSeparator(writer); + GenerateSectionSeparator(writer); List listOfCommandNames = GetListOfCommandNames(listOfCommandMetadata); string exportString = GenerateArrayString(listOfCommandNames); writer.Write(ExportFunctionsTemplate, exportString); } - private List GetListOfCommandNames(IEnumerable listOfCommandMetadata) + private static List GetListOfCommandNames(IEnumerable listOfCommandMetadata) { if (listOfCommandMetadata == null) { @@ -2930,7 +2930,7 @@ function Get-PSImplicitRemotingClientSideParameters return listOfCommandNames; } - private string GenerateArrayString(IEnumerable listOfStrings) + private static string GenerateArrayString(IEnumerable listOfStrings) { if (listOfStrings == null) { @@ -2968,9 +2968,9 @@ function Get-PSImplicitRemotingClientSideParameters & $script:ExportModuleMember -Alias {0} "; - private void GenerateAliases(TextWriter writer, Dictionary alias2resolvedCommandName) + private static void GenerateAliases(TextWriter writer, Dictionary alias2resolvedCommandName) { - this.GenerateSectionSeparator(writer); + GenerateSectionSeparator(writer); foreach (KeyValuePair pair in alias2resolvedCommandName) { @@ -2991,7 +2991,7 @@ function Get-PSImplicitRemotingClientSideParameters #region Generating format.ps1xml file - private void GenerateFormatFile(TextWriter writer, List listOfFormatData) + private static void GenerateFormatFile(TextWriter writer, List listOfFormatData) { if (writer == null) { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Join-String.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Join-String.cs index 652e32652c..c1bcabef81 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Join-String.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Join-String.cs @@ -177,7 +177,7 @@ namespace Microsoft.PowerShell.Commands.Utility return null; } - private IEnumerable CompleteFormatString(string wordToComplete) + private static IEnumerable CompleteFormatString(string wordToComplete) { var res = new List(); void AddMatching(string completionText) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs index 6ea48b6242..529687db68 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs @@ -619,7 +619,7 @@ namespace Microsoft.PowerShell.Commands /// If true is passed in then the minimum of the two values would be returned. /// If false is passed in then maximum of the two values will be returned. /// - private object Compare(object objValue, object statMinOrMaxValue, bool isMin) + private static object Compare(object objValue, object statMinOrMaxValue, bool isMin) { object currentValue = objValue; object statValue = statMinOrMaxValue; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs index b13d310771..ba5a8f8a53 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/UnblockFile.cs @@ -197,7 +197,7 @@ namespace Microsoft.PowerShell.Commands } #if UNIX - private bool IsBlocked(string path) + private static bool IsBlocked(string path) { uint valueSize = 1024; IntPtr value = Marshal.AllocHGlobal((int)valueSize); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs index 603aeb6000..9f7e10b4dc 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Update-TypeData.cs @@ -570,7 +570,7 @@ namespace Microsoft.PowerShell.Commands } } - private T GetParameterType(object sourceValue) + private static T GetParameterType(object sourceValue) { return (T)LanguagePrimitives.ConvertTo(sourceValue, typeof(T), CultureInfo.InvariantCulture); } @@ -746,7 +746,7 @@ namespace Microsoft.PowerShell.Commands /// /// /// - private ErrorRecord NewError(string errorId, string template, object targetObject, params object[] args) + private static ErrorRecord NewError(string errorId, string template, object targetObject, params object[] args) { string message = string.Format(CultureInfo.CurrentCulture, template, args); ErrorRecord errorRecord = new ErrorRecord( @@ -1255,7 +1255,7 @@ namespace Microsoft.PowerShell.Commands this.Context.TypeTable.ClearConsolidatedMembers(); } - private ErrorRecord NewError(string errorId, string template, object targetObject, params object[] args) + private static ErrorRecord NewError(string errorId, string template, object targetObject, params object[] args) { string message = string.Format(CultureInfo.CurrentCulture, template, args); ErrorRecord errorRecord = new ErrorRecord( diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs index ac04bf14dc..76d5283f79 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs @@ -185,7 +185,7 @@ namespace Microsoft.PowerShell.Commands } } - private PSObject CreateHtmlObject(string html, string tagName) + private static PSObject CreateHtmlObject(string html, string tagName) { PSObject elementObject = new PSObject(); @@ -197,7 +197,7 @@ namespace Microsoft.PowerShell.Commands return elementObject; } - private void EnsureHtmlParser() + private static void EnsureHtmlParser() { if (s_tagRegex == null) { @@ -243,7 +243,7 @@ namespace Microsoft.PowerShell.Commands this.RawContent = raw.ToString(); } - private void ParseAttributes(string outerHtml, PSObject elementObject) + private static void ParseAttributes(string outerHtml, PSObject elementObject) { // We might get an empty input for a directive from the HTML file if (!string.IsNullOrEmpty(outerHtml)) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs index ba1e69c080..85073a911c 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs @@ -143,7 +143,7 @@ namespace Microsoft.PowerShell.Commands } // Mostly cribbed from Serialization.cs#GetXmlReaderSettingsForCliXml() - private XmlReaderSettings GetSecureXmlReaderSettings() + private static XmlReaderSettings GetSecureXmlReaderSettings() { XmlReaderSettings xrs = new XmlReaderSettings(); @@ -159,7 +159,7 @@ namespace Microsoft.PowerShell.Commands return xrs; } - private bool TryConvertToXml(string xml, out object doc, ref Exception exRef) + private static bool TryConvertToXml(string xml, out object doc, ref Exception exRef) { try { @@ -181,7 +181,7 @@ namespace Microsoft.PowerShell.Commands return (doc != null); } - private bool TryConvertToJson(string json, out object obj, ref Exception exRef) + private static bool TryConvertToJson(string json, out object obj, ref Exception exRef) { bool converted = false; try @@ -478,7 +478,7 @@ namespace Microsoft.PowerShell.Commands #region Helper Methods - private RestReturnType CheckReturnType(HttpResponseMessage response) + private static RestReturnType CheckReturnType(HttpResponseMessage response) { if (response == null) { throw new ArgumentNullException(nameof(response)); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs index 6e8e5c471b..2005d587b9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs @@ -751,7 +751,7 @@ namespace Microsoft.PowerShell.Commands return uri; } - private Uri CheckProtocol(Uri uri) + private static Uri CheckProtocol(Uri uri) { if (uri == null) { throw new ArgumentNullException(nameof(uri)); } @@ -769,7 +769,7 @@ namespace Microsoft.PowerShell.Commands return resolvedFilePath; } - private string FormatDictionary(IDictionary content) + private static string FormatDictionary(IDictionary content) { if (content == null) throw new ArgumentNullException(nameof(content)); @@ -1916,7 +1916,7 @@ namespace Microsoft.PowerShell.Commands /// /// The Field Name to use for the /// The Field Value to use for the - private StringContent GetMultipartStringContent(object fieldName, object fieldValue) + private static StringContent GetMultipartStringContent(object fieldName, object fieldValue) { var contentDisposition = new ContentDispositionHeaderValue("form-data"); // .NET does not enclose field names in quotes, however, modern browsers and curl do. @@ -1933,7 +1933,7 @@ namespace Microsoft.PowerShell.Commands /// /// The Field Name to use for the /// The to use for the - private StreamContent GetMultipartStreamContent(object fieldName, Stream stream) + private static StreamContent GetMultipartStreamContent(object fieldName, Stream stream) { var contentDisposition = new ContentDispositionHeaderValue("form-data"); // .NET does not enclose field names in quotes, however, modern browsers and curl do. @@ -1951,7 +1951,7 @@ namespace Microsoft.PowerShell.Commands /// /// The Field Name to use for the /// The file to use for the - private StreamContent GetMultipartFileContent(object fieldName, FileInfo file) + private static StreamContent GetMultipartFileContent(object fieldName, FileInfo file) { var result = GetMultipartStreamContent(fieldName: fieldName, stream: new FileStream(file.FullName, FileMode.Open)); // .NET does not enclose field names in quotes, however, modern browsers and curl do. diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs index 8d7a08b46b..98e7c397e4 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs @@ -76,7 +76,7 @@ namespace Microsoft.PowerShell.Commands this.Content = this.RawContentStream.ToArray(); } - private bool IsPrintable(char c) + private static bool IsPrintable(char c) { return (char.IsLetterOrDigit(c) || char.IsPunctuation(c) || char.IsSeparator(c) || char.IsSymbol(c) || char.IsWhiteSpace(c)); }