Showing the changes to Source/Libraries/GSF.Core/StringExtensions.cs (1 of 3 files). Show all
Unified · Split
| @@ -206,12 +206,8 @@ namespace GSF · 205 unmodified lines | ||
| 206 | 206 | try |
| 207 | 207 | { |
| 208 | 208 | // Handle booleans as a special case to allow numeric entries as well as true/false |
| 209 | − if (type.IsAssignableFrom(typeof(bool))) | |
| 210 | − return (T)((object)value.ParseBoolean()); | |
| 211 | − | |
| 212 | − // This is faster for native types than using type converter... | |
| 213 | − if (type.IsAssignableFrom(typeof(IConvertible))) | |
| 214 | − return (T)Convert.ChangeType(value, type, culture); | |
| 209 | + if (type == typeof(bool)) | |
| 210 | + return (T)(object)value.ParseBoolean(); | |
| 215 | 211 | |
| 216 | 212 | // Handle objects that have type converters (e.g., Enum, Color, Point, etc.) |
| 217 | 213 | TypeConverter converter = TypeDescriptor.GetConverter(type); |