Xceed.Wpf.Toolkit.DateTimeParser.GetDateParts C# (CSharp) Méthode

GetDateParts() private static méthode

private static GetDateParts ( System.DateTime currentDate, CultureInfo cultureInfo ) : string>.Dictionary
currentDate System.DateTime
cultureInfo System.Globalization.CultureInfo
Résultat string>.Dictionary
    private static Dictionary<string, string> GetDateParts( DateTime currentDate, CultureInfo cultureInfo )
    {
      Dictionary<string, string> dateParts = new Dictionary<string, string>();
      var dateTimeSeparators = new[] { ",", " ", "-", ".", "/", cultureInfo.DateTimeFormat.DateSeparator, cultureInfo.DateTimeFormat.TimeSeparator };
      var dateFormatParts = cultureInfo.DateTimeFormat.ShortDatePattern.Split( dateTimeSeparators, StringSplitOptions.RemoveEmptyEntries ).ToList();
      dateFormatParts.ForEach( item =>
      {
        string key = string.Empty;
        string value = string.Empty;

        if( item.Contains( "M" ) )
        {
          key = "Month";
          value = currentDate.Month.ToString();
        }
        else if( item.Contains( "d" ) )
        {
          key = "Day";
          value = currentDate.Day.ToString();
        }
        else if( item.Contains( "y" ) )
        {
          key = "Year";
          value = currentDate.Year.ToString("D4");
        }
        if( !dateParts.ContainsKey( key ) )
        {
          dateParts.Add( key, value );
        }
      } );
      return dateParts;
    }
  }