Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ internal static string GetLocalAdminUserName(string computerName, PSCredential p
string localUserName = null;

// The format of local admin username should be "ComputerName\AdminName"
if (psLocalCredential.UserName.Contains("\\"))
if (psLocalCredential.UserName.Contains('\\'))
{
localUserName = psLocalCredential.UserName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ private static bool IsSafeNameOrIdentifier(string name)
/// <returns><see langword="true"/> if the name is safe; <see langword="false"/> otherwise.</returns>
private static bool IsSafeParameterName(string parameterName)
{
return IsSafeNameOrIdentifier(parameterName) && !parameterName.Contains(":");
return IsSafeNameOrIdentifier(parameterName) && !parameterName.Contains(':');
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.WSMan.Management/ConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3573,7 +3573,7 @@ private string GetCorrectCaseOfName(string ChildName, string hostname, string pa
string result = ChildName;
if (ChildName != null)
{
if (!ChildName.Contains("_"))
if (!ChildName.Contains('_'))
{
if (ChildName.Equals(WSManStringLiterals.containerQuotasParameters, StringComparison.OrdinalIgnoreCase))
result = WSManStringLiterals.containerQuotasParameters;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.WSMan.Management/WsManHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ internal static void LoadResourceData()
while (!_sr.EndOfStream)
{
string Line = _sr.ReadLine();
if (Line.Contains("="))
if (Line.Contains('='))
{
string[] arr = Line.Split('=', count: 2);
if (!ResourceValueCache.ContainsKey(arr[0].Trim()))
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/DscSupport/CimDSCParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ public static void LoadResourcesFromModule(IScriptExtent scriptExtent,
}

// resource name without wildcard (*) should be imported only once
if (!resourceToImport.Contains("*") && foundResources)
if (!resourceToImport.Contains('*') && foundResources)
{
resourcesFound.Add(resourceToImport);
}
Expand All @@ -2170,7 +2170,7 @@ public static void LoadResourcesFromModule(IScriptExtent scriptExtent,
{
foreach (var resourceNameToImport in resourcesToImport)
{
if (!resourceNameToImport.Contains("*"))
if (!resourceNameToImport.Contains('*'))
{
errorList.Add(new ParseError(scriptExtent,
"DscResourcesNotFoundDuringParsing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ internal static string FormatField(FieldFormattingDirective directive, object va
{
// use some heuristics to determine if we have "composite formatting"
// 2004/11/16-JonN This is heuristic but should be safe enough
if (directive.formatString.Contains("{0") || directive.formatString.Contains("}"))
if (directive.formatString.Contains("{0") || directive.formatString.Contains('}'))
{
// we do have it, just use it
return string.Format(CultureInfo.CurrentCulture, directive.formatString, so);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ private static CommandInfo TryNormalSearch(string commandName,
{
if (!searcher.MoveNext())
{
if (!commandName.Contains("-") && !commandName.Contains("\\"))
if (!commandName.Contains('-') && !commandName.Contains('\\'))
{
discoveryTracer.WriteLine(
"The command [{0}] was not found, trying again with get- prepended",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ public override object Transform(EngineIntrinsics engineIntrinsics, object input
return PSVersionInfo.PSVersion;
}

if (versionStr.Contains("."))
if (versionStr.Contains('.'))
{
// If the string contains a '.', let the Version constructor handle the conversion.
return inputData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@ protected static object BaseConvertFrom(object sourceValue, Type destinationType
WildcardPattern[] fromValuePatterns;
if (!multipleValues)
{
if (sourceValueString.Contains(","))
if (sourceValueString.Contains(','))
{
throw new PSInvalidCastException("InvalidCastEnumCommaAndNoFlags", null,
ExtendedTypeSystem.InvalidCastExceptionEnumerationNoFlagAndComma,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2373,7 +2373,7 @@ public object[] ModulesToImport
// Add this check after checking if it a path
if (!string.IsNullOrEmpty(modulepath.Trim()))
{
if ((modulepath.Contains("\\") || modulepath.Contains(":")) &&
if ((modulepath.Contains('\\') || modulepath.Contains(':')) &&
!(Directory.Exists(modulepath) || File.Exists(modulepath)))
{
throw new ArgumentException(
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/SaveHelpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ internal override bool ProcessModuleWithCulture(UpdatableHelpModuleInfo module,

if (_credential != null)
{
if (path.Contains("*"))
if (path.Contains('*'))
{
// Deal with wildcards

Expand Down