- Timestamp:
- 09/16/19 16:12:21 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringArray.cs
r17226 r17253 26 26 using System.Linq; 27 27 using System.Text; 28 using HEAL.Attic; 28 29 using HeuristicLab.Common; 29 30 using HeuristicLab.Core; 30 using HEAL.Attic;31 31 32 32 namespace HeuristicLab.Data { … … 131 131 elementNames = new List<string>(); 132 132 } 133 public StringArray(string[] elements ) {133 public StringArray(string[] elements, bool @readonly = false) { 134 134 if (elements == null) throw new ArgumentNullException(); 135 135 array = new string[elements.Length]; 136 136 for (int i = 0; i < array.Length; i++) 137 137 array[i] = elements[i] == null ? string.Empty : elements[i]; 138 readOnly = false;138 readOnly = @readonly; 139 139 resizable = true; 140 140 elementNames = new List<string>(); … … 146 146 147 147 public virtual StringArray AsReadOnly() { 148 StringArray readOnlyStringArray = (StringArray)this.Clone(); 149 readOnlyStringArray.readOnly = true; 150 return readOnlyStringArray; 148 if (ReadOnly) return this; 149 var clone = (StringArray)this.Clone(); 150 clone.readOnly = true; 151 return clone; 151 152 } 152 153 IValueTypeArray IValueTypeArray.AsReadOnly() {
Note: See TracChangeset
for help on using the changeset viewer.