System.DateTimeFormat.GetAllDateTimes C# (CSharp) Méthode

GetAllDateTimes() static private méthode

static private GetAllDateTimes ( System.DateTime dateTime, char format, DateTimeFormatInfo dtfi ) : String[]
dateTime System.DateTime
format char
dtfi System.Globalization.DateTimeFormatInfo
Résultat String[]
        internal static String[] GetAllDateTimes(DateTime dateTime, char format, DateTimeFormatInfo dtfi)
        {
            String [] allFormats    = null;
            String [] results       = null;
            
            switch (format)
            {
                case 'd':
                case 'D':                            
                case 'f':
                case 'F':
                case 'g':
                case 'G':
                case 'm':
                case 'M':
                case 't':
                case 'T':                
                case 'y':
                case 'Y':
                    allFormats = dtfi.GetAllDateTimePatterns(format);
                    results = new String[allFormats.Length];
                    for (int i = 0; i < allFormats.Length; i++)
                    {
                        results[i] = Format(dateTime, allFormats[i], dtfi);
                    }
                    break;
                case 'U':
                    DateTime universalTime = dateTime.ToUniversalTime();
                    allFormats = dtfi.GetAllDateTimePatterns(format);
                    results = new String[allFormats.Length];
                    for (int i = 0; i < allFormats.Length; i++)
                    {
                        results[i] = Format(universalTime, allFormats[i], dtfi);
                    }
                    break;                
                //
                // The following ones are special cases because these patterns are read-only in
                // DateTimeFormatInfo.
                //
                case 'r':
                case 'R':
                case 'o':
                case 'O':
                case 's':
                case 'u':            
                    results = new String[] {Format(dateTime, new String(new char[] {format}), dtfi)};
                    break;   
                default:
                    throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
                
            }
            return (results);
        }
    

Same methods

DateTimeFormat::GetAllDateTimes ( System.DateTime dateTime, DateTimeFormatInfo dtfi ) : String[]

Usage Example

        // Token: 0x060015F2 RID: 5618 RVA: 0x00041624 File Offset: 0x0003F824
        internal static string[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
        {
            List <string> list = new List <string>(132);

            for (int i = 0; i < DateTimeFormat.allStandardFormats.Length; i++)
            {
                string[] allDateTimes = DateTimeFormat.GetAllDateTimes(dateTime, DateTimeFormat.allStandardFormats[i], dtfi);
                for (int j = 0; j < allDateTimes.Length; j++)
                {
                    list.Add(allDateTimes[j]);
                }
            }
            string[] array = new string[list.Count];
            list.CopyTo(0, array, 0, list.Count);
            return(array);
        }
All Usage Examples Of System.DateTimeFormat::GetAllDateTimes