Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/16/19 16:12:21 (5 years ago)
Author:
abeham
Message:

#2521: worked on refactoring PTSP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringArray.cs

    r17226 r17253  
    2626using System.Linq;
    2727using System.Text;
     28using HEAL.Attic;
    2829using HeuristicLab.Common;
    2930using HeuristicLab.Core;
    30 using HEAL.Attic;
    3131
    3232namespace HeuristicLab.Data {
     
    131131      elementNames = new List<string>();
    132132    }
    133     public StringArray(string[] elements) {
     133    public StringArray(string[] elements, bool @readonly = false) {
    134134      if (elements == null) throw new ArgumentNullException();
    135135      array = new string[elements.Length];
    136136      for (int i = 0; i < array.Length; i++)
    137137        array[i] = elements[i] == null ? string.Empty : elements[i];
    138       readOnly = false;
     138      readOnly = @readonly;
    139139      resizable = true;
    140140      elementNames = new List<string>();
     
    146146
    147147    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;
    151152    }
    152153    IValueTypeArray IValueTypeArray.AsReadOnly() {
Note: See TracChangeset for help on using the changeset viewer.