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 @@ -60,7 +60,7 @@ public string[] Path
//
// name of this command
//
private string commandName;
private readonly string commandName;

/// <summary>
/// Initializes a new instance of the CatalogCommandsBase class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public string[] LiteralPath
//
// list of files that were not found
//
private List<string> _filesNotFound = new List<string>();
private readonly List<string> _filesNotFound = new List<string>();

/// <summary>
/// Initializes a new instance of the GetPfxCertificateCommand
Expand Down
22 changes: 11 additions & 11 deletions src/Microsoft.PowerShell.Security/security/CertificateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ public struct DnsNameRepresentation
/// <summary>
/// Punycode version of DNS name.
/// </summary>
private string _punycodeName;
private readonly string _punycodeName;

/// <summary>
/// Unicode version of DNS name.
/// </summary>
private string _unicodeName;
private readonly string _unicodeName;

/// <summary>
/// Ambiguous constructor of a DnsNameRepresentation.
Expand Down Expand Up @@ -511,8 +511,8 @@ public bool Valid
}

private bool _archivedCerts = false;
private X509StoreLocation _storeLocation = null;
private string _storeName = null;
private readonly X509StoreLocation _storeLocation = null;
private readonly string _storeName = null;
private CertificateStoreHandle _storeHandle = null;
private bool _valid = false;
private bool _open = false;
Expand Down Expand Up @@ -581,7 +581,7 @@ public sealed class CertificateProvider : NavigationCmdletProvider, ICmdletProvi
/// -- storeLocations
/// -- pathCache.
/// </summary>
private static object s_staticLock = new object();
private static readonly object s_staticLock = new object();

/// <summary>
/// List of store locations. They do not change once initialized.
Expand Down Expand Up @@ -3068,12 +3068,12 @@ public struct EnhancedKeyUsageRepresentation
/// <summary>
/// Localized friendly name of EKU.
/// </summary>
private string _friendlyName;
private readonly string _friendlyName;

/// <summary>
/// OID of EKU.
/// </summary>
private string _oid;
private readonly string _oid;

/// <summary>
/// Constructor of an EnhancedKeyUsageRepresentation.
Expand Down Expand Up @@ -3302,7 +3302,7 @@ private static string[] GetPathElements(string path)
/// </summary>
public sealed class EnhancedKeyUsageProperty
{
private List<EnhancedKeyUsageRepresentation> _ekuList = new List<EnhancedKeyUsageRepresentation>();
private readonly List<EnhancedKeyUsageRepresentation> _ekuList = new List<EnhancedKeyUsageRepresentation>();

/// <summary>
/// Get property of EKUList.
Expand Down Expand Up @@ -3345,8 +3345,8 @@ public EnhancedKeyUsageProperty(X509Certificate2 cert)
/// </summary>
public sealed class DnsNameProperty
{
private List<DnsNameRepresentation> _dnsList = new List<DnsNameRepresentation>();
private System.Globalization.IdnMapping idnMapping = new System.Globalization.IdnMapping();
private readonly List<DnsNameRepresentation> _dnsList = new List<DnsNameRepresentation>();
private readonly System.Globalization.IdnMapping idnMapping = new System.Globalization.IdnMapping();

private const string dnsNamePrefix = "DNS Name=";
private const string distinguishedNamePrefix = "CN=";
Expand Down Expand Up @@ -3552,7 +3552,7 @@ internal static class Crypt32Helpers
/// Lock that guards access to the following static members
/// -- storeNames.
/// </summary>
private static object s_staticLock = new object();
private static readonly object s_staticLock = new object();

internal static readonly List<string> storeNames = new List<string>();

Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.PowerShell.Security/security/CmsCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public PSObject Content
set;
}

private PSDataCollection<PSObject> _inputObjects = new PSDataCollection<PSObject>();
private readonly PSDataCollection<PSObject> _inputObjects = new PSDataCollection<PSObject>();

/// <summary>
/// Gets or sets the content of the CMS Message by path.
Expand Down Expand Up @@ -206,7 +206,7 @@ public string Content
set;
}

private StringBuilder _contentBuffer = new StringBuilder();
private readonly StringBuilder _contentBuffer = new StringBuilder();

/// <summary>
/// Gets or sets the CMS Message by path.
Expand Down Expand Up @@ -351,7 +351,7 @@ public string Content
set;
}

private StringBuilder _contentBuffer = new StringBuilder();
private readonly StringBuilder _contentBuffer = new StringBuilder();

/// <summary>
/// Gets or sets the Windows Event Log Message with contents to be decrypted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected SecureString SecureStringData
//
// name of this command
//
private string _commandName;
private readonly string _commandName;

/// <summary>
/// Initializes a new instance of the SecureStringCommandBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public byte[] Content
//
// name of this command
//
private string _commandName;
private readonly string _commandName;

/// <summary>
/// Initializes a new instance of the SignatureCommandsBase class,
Expand Down