History

GSF.Core: Fixed type conversions for Guids and Enums in AdoDataConnection.ExecuteScalar<T>().

StephenCWills committed 10 years ago

Commit c021a4c1 parent 1ac4ccb3 files · +19 −8Browse files

Showing the changes to Source/Libraries/GSF.Core/StringExtensions.cs (1 of 3 files). Show all

Unified · Split

Source/Libraries/GSF.Core/StringExtensions.cs+2−6
@@ -206,12 +206,8 @@ namespace GSF · 205 unmodified lines
206 try206 try
207 {207 {
208 // Handle booleans as a special case to allow numeric entries as well as true/false208 // Handle booleans as a special case to allow numeric entries as well as true/false
209 if (type.IsAssignableFrom(typeof(bool)))209 if (type == typeof(bool))
210 return (T)((object)value.ParseBoolean());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);
215 211
216 // Handle objects that have type converters (e.g., Enum, Color, Point, etc.)212 // Handle objects that have type converters (e.g., Enum, Color, Point, etc.)
217 TypeConverter converter = TypeDescriptor.GetConverter(type);213 TypeConverter converter = TypeDescriptor.GetConverter(type);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t