/// <summary>
        /// Initializes a new instance of the <see cref="BirthDateFormat"/> class.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="birthDateFormatInfo"></param>
        public BirthDateFormat(string format, BirthDateFormatInfo birthDateFormatInfo)
        {
            _birthDateFormatInfo = birthDateFormatInfo ?? throw new ArgumentNullException(nameof(birthDateFormatInfo));
            _format = format ?? birthDateFormatInfo.DefaultFormat;

            var cultureInfo = birthDateFormatInfo.CultureInfo;

            _dateTimeFormatInfo = DateTimeFormatInfo.GetInstance(cultureInfo);
            _calendar           = cultureInfo.Calendar;
        }
Beispiel #2
0
 /// <summary>
 /// Try get instance of the <see cref="BirthDateFormatInfo"/> class using the given <see cref="IFormatProvider"/>.
 /// </summary>
 /// <param name="formatProvider"></param>
 /// <param name="birthDateFormatInfo"></param>
 /// <returns></returns>
 internal static bool TryGetInstance(IFormatProvider formatProvider, out BirthDateFormatInfo birthDateFormatInfo)
 {
     birthDateFormatInfo = formatProvider.GetFormat(typeof(BirthDateFormatInfo)) as BirthDateFormatInfo;
     return(birthDateFormatInfo != null);
 }