Skip to content

Commit f68cce7

Browse files
committed
Fix ExcelDnaUtils.ExcelLimits initialization to be race-free
1 parent 9f1e408 commit f68cce7

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

Source/ExcelDna.Integration/Excel.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -758,23 +758,14 @@ internal static Guid GuidFromXllPath(string path)
758758
#endregion
759759

760760
#region ExcelLimits
761-
private static ExcelLimits _xlLimits;
762-
public static ExcelLimits ExcelLimits
761+
static readonly ExcelLimits _xlLimits = new ExcelLimits
763762
{
764-
get
765-
{
766-
if (_xlLimits == null)
767-
{
768-
_xlLimits = new ExcelLimits();
769-
770-
_xlLimits.MaxRows = 1048576;
771-
_xlLimits.MaxColumns = 16384;
772-
_xlLimits.MaxArguments = 256;
773-
_xlLimits.MaxStringLength = 32767;
774-
}
775-
return _xlLimits;
776-
}
777-
}
763+
MaxRows = 1048576,
764+
MaxColumns = 16384,
765+
MaxArguments = 256,
766+
MaxStringLength = 32767
767+
};
768+
public static ExcelLimits ExcelLimits => _xlLimits;
778769
#endregion
779770

780771
#region SupportsDynamicArrays

0 commit comments

Comments
 (0)