Piotr Czajkowski 4 months ago
parent
commit
0e06e19a97
1 changed files with 2 additions and 4 deletions
  1. 2 4
      ExcelORM/ExcelORM/Mapping.cs

+ 2 - 4
ExcelORM/ExcelORM/Mapping.cs

@@ -17,10 +17,8 @@ namespace ExcelORM
             foreach (var property in properties)
             {
                 int? position;
-                var attribute =
-                    property.GetCustomAttributes(typeof(ColumnAttribute), false).FirstOrDefault() as ColumnAttribute;
-                        
-                if (attribute is { Names.Length: > 0 })
+
+                if (property.GetCustomAttributes(typeof(ColumnAttribute), false).FirstOrDefault() is ColumnAttribute { Names.Length: > 0 } attribute)
                     position = headerCells.FirstOrDefault(x => !x.Value.IsBlank && Array.Exists(attribute.Names,
                             y => y.Equals(x.Value.ToString(), StringComparison.InvariantCultureIgnoreCase)))?.Address
                         .ColumnNumber;