Skip to content

Commit

Permalink
use for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneDelcroix committed Mar 22, 2022
1 parent 4829bd7 commit 69bd31b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
{
var lengths = strValue.Split(',');
var converter = new GridLengthTypeConverter();
return new ColumnDefinitionCollection(lengths.Select(length => new ColumnDefinition {Width = (GridLength)converter.ConvertFromInvariantString(length) }).ToArray());
var definitions = new ColumnDefinition[lengths.Length];
for (var i = 0; i < lengths.Length; i++)
definitions[i] = new ColumnDefinition { Width = (GridLength)converter.ConvertFromInvariantString(lengths[i]) };
return new ColumnDefinitionCollection(definitions);
}

throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", strValue, typeof(ColumnDefinitionCollection)));
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/SourceGen/Controls.SourceGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0-1.final" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0-4.final" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 69bd31b

Please sign in to comment.