public static void FillBySingleFied <T>(IDataReader reader, IList <T> list) { if (reader == null || list == null) { return; } try { IDictionary <String, Int32> columnNameDict = new Dictionary <String, Int32>(); IDictionary <Int32, Type> typeDict = new Dictionary <Int32, Type>(); while (reader.Read()) { Int32 columnIndex = 0; Type columnType = getFieldType(typeDict, columnIndex, reader); Object value = getFieldValue(columnIndex, columnType, typeof(T), reader); T t = TypeUtils.ChangeType <T>(value); list.Add(t); } } catch { throw; } }
public void OnGUI() { eventName = EditorGUILayout.TextField("Event Name", eventName); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Event Type", GUILayout.Width(145)); eventTypeIndex = EditorGUILayout.Popup(eventTypeIndex, MyEventType.typeList.ToArray()); EditorGUILayout.EndHorizontal(); DrawValueProperty(typeIndex); if (GUILayout.Button("Send Event")) { var eventData = TypeUtils.ChangeType(value, MyPreferredType.Find(typeIndex)); string eventKey = MyEventType.typeList[eventTypeIndex]; string eventType = MyEventType.typeDict[eventKey]; if (string.Equals("Default", eventType)) { EventSender.SendGlobalEvent(eventName, eventData); } else { EventSender.Dispatch(eventType, eventName, eventData); } } }