Пример #1
0
        /// <summary>
        /// Initializes a new factory and populates decider <see cref="Dictionary"/>
        /// </summary>
        /// <param name="culture"></param>
        public TypeDeciderFactory(CultureInfo culture)
        {
            Settings = new GuessSettingsFactory().Create();

            var deciders = new IDecideTypesForStrings[]
            {
                new BoolTypeDecider(culture)
                {
                    Settings = Settings
                },
                new IntTypeDecider(culture)
                {
                    Settings = Settings
                },
                new DecimalTypeDecider(culture)
                {
                    Settings = Settings
                },

                new NeverGuessTheseTypeDecider(culture)
                {
                    Settings = Settings
                },

                new TimeSpanTypeDecider(culture)
                {
                    Settings = Settings
                },
                new DateTimeTypeDecider(culture)
                {
                    Settings = Settings
                },
            };

            foreach (IDecideTypesForStrings decider in deciders)
            {
                foreach (Type type in decider.TypesSupported)
                {
                    Dictionary.Add(type, decider);
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Copies all values of this object into <paramref name="copyInto"/>
 /// </summary>
 /// <param name="copyInto">The instance to populate with the current values of this</param>
 public void CopyTo(GuessSettings copyInto)
 {
     copyInto.CharCanBeBoolean    = CharCanBeBoolean;
     copyInto.ExplicitDateFormats = ExplicitDateFormats;
 }