Skip to content

Commit 4c8bca8

Browse files
committed
Fix compiler warnings
Signed-off-by: andreas hilti <[email protected]>
1 parent 896632f commit 4c8bca8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cyclonedx/Commands/KeyGenCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal static void Configure(RootCommand rootCommand)
3737
public static async Task<int> KeyGen(KeyGenCommandOptions options)
3838
{
3939
Console.WriteLine("Generating new public/private key pair...");
40-
using (RSA rsa = new RSACryptoServiceProvider(2048))
40+
using (var rsa = new RSACryptoServiceProvider(2048))
4141
{
4242
var publicKeyFilename = string.IsNullOrEmpty(options.PublicKeyFile) ? "public.key" : options.PublicKeyFile;
4343
Console.WriteLine($"Saving public key to {publicKeyFilename}");

src/cyclonedx/Serialization/CsvSerializer.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static string Serialize(Bom bom)
6161
csv.WriteField("SwidTextEncoding");
6262
csv.WriteField("SwidTextContent");
6363
csv.WriteField("SwidUrl");
64-
var hashAlgorithms = Enum.GetValues(typeof(Hash.HashAlgorithm)).Cast<Hash.HashAlgorithm>();
64+
var hashAlgorithms = Enum.GetValues(typeof(Hash.HashAlgorithm)).Cast<Hash.HashAlgorithm>().ToList();
6565
foreach (var hashAlgorithm in hashAlgorithms)
6666
{
6767
if (hashAlgorithm != Hash.HashAlgorithm.Null)
@@ -221,7 +221,7 @@ public static Bom Deserialize(string csv)
221221
if (!string.IsNullOrEmpty(hash.Content)) hashes.Add(hash);
222222
}
223223
}
224-
if (hashes.Any()) component.Hashes = hashes;
224+
if (hashes.Count != 0) component.Hashes = hashes;
225225

226226
var componentLicenses = new List<LicenseChoice>();
227227
var licenseExpressions = csvReader.GetField("LicenseExpressions")?.Split(',');
@@ -261,7 +261,7 @@ public static Bom Deserialize(string csv)
261261
}
262262
});
263263
}
264-
if (componentLicenses.Any()) component.Licenses = componentLicenses;
264+
if (componentLicenses.Count != 0) component.Licenses = componentLicenses;
265265

266266
bom.Components.Add(component);
267267
}

0 commit comments

Comments
 (0)