Browse Source

using System.Collections.ObjectModel;

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4373 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
3810b27401
  1. 9
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IFreezable.cs

9
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IFreezable.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
@ -75,7 +76,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{ {
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
return EmptyList<T>.Instance; return EmptyList<T>.Instance;
list = new System.Collections.ObjectModel.ReadOnlyCollection<T>(list.ToArray()); list = new ReadOnlyCollection<T>(list.ToArray());
foreach (T item in list) { foreach (T item in list) {
item.Freeze(); item.Freeze();
} }
@ -87,7 +88,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
return EmptyList<IReturnType>.Instance; return EmptyList<IReturnType>.Instance;
else else
return new System.Collections.ObjectModel.ReadOnlyCollection<IReturnType>(list.ToArray()); return new ReadOnlyCollection<IReturnType>(list.ToArray());
} }
protected static IList<string> FreezeList(IList<string> list) protected static IList<string> FreezeList(IList<string> list)
@ -95,12 +96,12 @@ namespace ICSharpCode.SharpDevelop.Dom
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
return EmptyList<string>.Instance; return EmptyList<string>.Instance;
else else
return new System.Collections.ObjectModel.ReadOnlyCollection<string>(list.ToArray()); return new ReadOnlyCollection<string>(list.ToArray());
} }
} }
static class EmptyList<T> static class EmptyList<T>
{ {
public static readonly System.Collections.ObjectModel.ReadOnlyCollection<T> Instance = new List<T>().AsReadOnly(); public static readonly ReadOnlyCollection<T> Instance = new ReadOnlyCollection<T>(new T[0]);
} }
} }

Loading…
Cancel
Save