Changeset 2931 for trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs
- Timestamp:
- 03/05/10 01:03:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs
r2851 r2931 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 25 using System.Xml; 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common;28 25 29 26 namespace HeuristicLab.Core { … … 38 35 get { return name; } 39 36 set { 40 if (!CanChangeName) throw new NotSupportedException("Name of NamedItem cannot be changed."); 41 if (value == null) throw new ArgumentNullException(); 42 if (!name.Equals(value)) { 43 CancelEventArgs<string> e = new CancelEventArgs<string>(value); 37 if (!CanChangeName) throw new NotSupportedException("Name cannot be changed."); 38 if (!(name.Equals(value) || (value == null) && (name == string.Empty))) { 39 CancelEventArgs<string> e = value == null ? new CancelEventArgs<string>(string.Empty) : new CancelEventArgs<string>(value); 44 40 OnNameChanging(e); 45 41 if (!e.Cancel) { 46 name = value ;42 name = value == null ? string.Empty : value; 47 43 OnNameChanged(); 48 44 } … … 58 54 get { return description; } 59 55 set { 60 if (!CanChangeDescription) throw new NotSupportedException("Description of NamedItemcannot be changed.");61 if ( (description == null) || (!description.Equals(value))) {62 description = value ;56 if (!CanChangeDescription) throw new NotSupportedException("Description cannot be changed."); 57 if (!(description.Equals(value) || (value == null) && (description == string.Empty))) { 58 description = value == null ? string.Empty : value; 63 59 OnDescriptionChanged(); 64 60 } … … 84 80 /// <param name="value">The value of the current instance.</param> 85 81 protected NamedItem(string name) { 86 if (name == null) th row new ArgumentNullException();87 this.name = name;82 if (name == null) this.name = string.Empty; 83 else this.name = name; 88 84 description = string.Empty; 89 85 } 90 86 protected NamedItem(string name, string description) { 91 if (name == null) throw new ArgumentNullException(); 92 this.name = name; 93 this.description = description; 87 if (name == null) this.name = string.Empty; 88 else this.name = name; 89 if (description == null) this.description = string.Empty; 90 else this.description = description; 94 91 } 95 92
Note: See TracChangeset
for help on using the changeset viewer.