PageRenderTime 36ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Languages/IronPython/IronPython/Runtime/CollectionDebugView.cs

http://github.com/IronLanguages/main
C# | 56 lines | 35 code | 7 blank | 14 comment | 0 complexity | 053231e279b7f537cab363d3ccaa06d9 MD5 | raw file
Possible License(s): CPL-1.0, BSD-3-Clause, ISC, GPL-2.0, MPL-2.0-no-copyleft-exception
  1. /* ****************************************************************************
  2. *
  3. * Copyright (c) Microsoft Corporation.
  4. *
  5. * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
  6. * copy of the license can be found in the License.html file at the root of this distribution. If
  7. * you cannot locate the Apache License, Version 2.0, please send an email to
  8. * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. * by the terms of the Apache License, Version 2.0.
  10. *
  11. * You must not remove this notice, or any other, from this software.
  12. *
  13. *
  14. * ***************************************************************************/
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Text;
  18. using System.Diagnostics;
  19. using System.Collections;
  20. namespace IronPython.Runtime {
  21. internal class CollectionDebugProxy {
  22. private readonly ICollection _collection;
  23. public CollectionDebugProxy(ICollection collection) {
  24. _collection = collection;
  25. }
  26. [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
  27. internal IList Members {
  28. get {
  29. List<object> res = new List<object>(_collection.Count);
  30. foreach (object o in _collection) {
  31. res.Add(o);
  32. }
  33. return res;
  34. }
  35. }
  36. }
  37. internal class ObjectCollectionDebugProxy {
  38. private readonly ICollection<object> _collection;
  39. public ObjectCollectionDebugProxy(ICollection<object> collection) {
  40. _collection = collection;
  41. }
  42. [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
  43. internal IList<object> Members {
  44. get {
  45. return new List<object>(_collection);
  46. }
  47. }
  48. }
  49. }