Skip to content

Commit 44e1c7e

Browse files
committed
Change candidates section to use old code syntax
1 parent e38cdbe commit 44e1c7e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/GitVersion.Configuration/ConfigurationFileLocator.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@ public void Verify(string? workingDirectory, string? projectRootDirectory)
3333
public string? GetConfigurationFile(string? directory)
3434
{
3535
if (directory is null) return null;
36-
var candidateList = new List<string>(SupportedConfigFileNames);
37-
if (!this.ConfigurationFile.IsNullOrEmpty())
38-
{
39-
// give configuration value the highest priority
40-
candidateList.Insert(0, this.ConfigurationFile);
41-
}
4236

43-
var candidatePaths = candidateList
44-
.Where(candidate => !string.IsNullOrWhiteSpace(candidate))
45-
.Select(candidate => PathHelper.Combine(directory, candidate))
46-
.ToList();
37+
string?[] candidates = [this.ConfigurationFile, ..SupportedConfigFileNames];
38+
var candidatePaths =
39+
from candidate in candidates
40+
where !candidate.IsNullOrWhiteSpace()
41+
select PathHelper.Combine(directory, candidate);
4742

4843
foreach (var candidatePath in candidatePaths)
4944
{

0 commit comments

Comments
 (0)