if (propType.HasValue)
{
Type specificType = typeof(CLRIReferenceImpl<>).MakeGenericType(type);
- return Activator.CreateInstance(specificType, new object[] { propType.Value, obj });
+ return Activator.CreateInstance(specificType, new object[] { propType.GetValueOrDefault(), obj });
}
Debug.Fail("We should not see non-WinRT type here");
{
// All WinRT value type will be Property.Other
Type specificType = typeof(CLRIReferenceArrayImpl<>).MakeGenericType(type);
- return Activator.CreateInstance(specificType, new object[] { propType.Value, obj });
+ return Activator.CreateInstance(specificType, new object[] { propType.GetValueOrDefault(), obj });
}
else
{
TimeSpan? parsedBaseOffset = TZif_ParseOffsetString(standardOffset);
if (parsedBaseOffset.HasValue)
{
- TimeSpan baseOffset = parsedBaseOffset.Value.Negate(); // offsets are backwards in POSIX notation
+ TimeSpan baseOffset = parsedBaseOffset.GetValueOrDefault().Negate(); // offsets are backwards in POSIX notation
baseOffset = TZif_CalculateTransitionOffsetFromBase(baseOffset, timeZoneBaseUtcOffset);
// having a daylightSavingsName means there is a DST rule
}
else
{
- daylightSavingsTimeSpan = parsedDaylightSavings.Value.Negate(); // offsets are backwards in POSIX notation
+ daylightSavingsTimeSpan = parsedDaylightSavings.GetValueOrDefault().Negate(); // offsets are backwards in POSIX notation
daylightSavingsTimeSpan = TZif_CalculateTransitionOffsetFromBase(daylightSavingsTimeSpan, timeZoneBaseUtcOffset);
daylightSavingsTimeSpan = TZif_CalculateTransitionOffsetFromBase(daylightSavingsTimeSpan, baseOffset);
}
if (result.HasValue && negative)
{
- result = result.Value.Negate();
+ result = result.GetValueOrDefault().Negate();
}
}
// Some time zones use time values like, "26", "144", or "-2".
// This allows the week to sometimes be week 4 and sometimes week 5 in the month.
// For now, strip off any 'days' in the offset, and just get the time of day correct
- timeOffset = new TimeSpan(timeOffset.Value.Hours, timeOffset.Value.Minutes, timeOffset.Value.Seconds);
- if (timeOffset.Value < TimeSpan.Zero)
+ timeOffset = new TimeSpan(timeOffset.GetValueOrDefault().Hours, timeOffset.GetValueOrDefault().Minutes, timeOffset.GetValueOrDefault().Seconds);
+ if (timeOffset.GetValueOrDefault() < TimeSpan.Zero)
{
timeOfDay = new DateTime(1, 1, 2, 0, 0, 0);
}
timeOfDay = new DateTime(1, 1, 1, 0, 0, 0);
}
- timeOfDay += timeOffset.Value;
+ timeOfDay += timeOffset.GetValueOrDefault();
}
else
{
{
Debug.Assert(rule.NoDaylightTransitions, "GetPreviousAdjustmentRule should only be used with NoDaylightTransitions rules.");
- if (ruleIndex.HasValue && 0 < ruleIndex.Value && ruleIndex.Value < _adjustmentRules.Length)
+ if (ruleIndex.HasValue && 0 < ruleIndex.GetValueOrDefault() && ruleIndex.GetValueOrDefault() < _adjustmentRules.Length)
{
- return _adjustmentRules[ruleIndex.Value - 1];
+ return _adjustmentRules[ruleIndex.GetValueOrDefault() - 1];
}
AdjustmentRule result = rule;