Changeset 11437 for trunk/sources
- Timestamp:
- 10/09/14 18:12:20 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs
r11436 r11437 40 40 [Content(typeof(VariableStore), true)] 41 41 public partial class VariableStoreView : AsynchronousContentView { 42 protected Dictionary<string, ListViewItem> itemListViewItemMapping; 42 protected readonly Dictionary<string, ListViewItem> itemListViewItemMapping; 43 protected readonly Dictionary<Type, bool> serializableLookup; 43 44 protected TypeSelectorDialog typeSelectorDialog; 44 45 protected bool validDragOperation; … … 56 57 InitializeComponent(); 57 58 itemListViewItemMapping = new Dictionary<string, ListViewItem>(); 59 serializableLookup = new Dictionary<Type, bool>(); 58 60 variableListView.SmallImageList.Images.AddRange(new Image[] { 59 61 HeuristicLab.Common.Resources.VSImageLibrary.Error, … … 397 399 398 400 private bool IsSerializable(KeyValuePair<string, object> variable) { 401 var type = variable.Value.GetType(); 402 bool serializable; 403 if (serializableLookup.TryGetValue(type, out serializable)) 404 return serializable; 399 405 var ser = new Serializer(variable, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()), "ROOT", true); 400 406 try { 401 return ser .Count() > 0;407 return serializableLookup[type] = ser.Any(); 402 408 } catch (PersistenceException) { 403 return false;409 return serializableLookup[type] = false; 404 410 } 405 411 }
Note: See TracChangeset
for help on using the changeset viewer.