Skip to content

Commit a722f56

Browse files
committed
Fix ExcelDnaUtils.ExcelLimits initialization to be race-free
1 parent 3fd75e7 commit a722f56

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
@@ -738,23 +738,14 @@ internal static Guid GuidFromXllPath(string path)
738738
#endregion
739739

740740
#region ExcelLimits
741-
private static ExcelLimits _xlLimits;
742-
public static ExcelLimits ExcelLimits
741+
static readonly ExcelLimits _xlLimits = new ExcelLimits
743742
{
744-
get
745-
{
746-
if (_xlLimits == null)
747-
{
748-
_xlLimits = new ExcelLimits();
749-
750-
_xlLimits.MaxRows = 1048576;
751-
_xlLimits.MaxColumns = 16384;
752-
_xlLimits.MaxArguments = 256;
753-
_xlLimits.MaxStringLength = 32767;
754-
}
755-
return _xlLimits;
756-
}
757-
}
743+
MaxRows = 1048576,
744+
MaxColumns = 16384,
745+
MaxArguments = 256,
746+
MaxStringLength = 32767
747+
};
748+
public static ExcelLimits ExcelLimits => _xlLimits;
758749
#endregion
759750

760751
#region SupportsDynamicArrays

0 commit comments

Comments
 (0)