PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/mcs/class/System/System.ComponentModel/ListSortDescriptionCollection.cs

https://bitbucket.org/danipen/mono
C# | 114 lines | 64 code | 25 blank | 25 comment | 0 complexity | 54ade48754336411c8827f46578f3268 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
  21. //
  22. // Author:
  23. // Pedro Martínez Juliá <pedromj@gmail.com>
  24. // Ivan N. Zlatev <contact@i-nz.net>
  25. //
  26. using System.Collections;
  27. namespace System.ComponentModel {
  28. public class ListSortDescriptionCollection : IList, ICollection, IEnumerable {
  29. ArrayList list;
  30. public ListSortDescriptionCollection () {
  31. list = new ArrayList();
  32. }
  33. public ListSortDescriptionCollection (ListSortDescription[] sorts) {
  34. list = new ArrayList();
  35. foreach (ListSortDescription item in sorts)
  36. list.Add (item);
  37. }
  38. public int Count {
  39. get { return list.Count; }
  40. }
  41. public ListSortDescription this [int index] {
  42. get { return list[index] as ListSortDescription; }
  43. set { throw new InvalidOperationException("ListSortDescriptorCollection is read only."); }
  44. }
  45. public bool Contains (object value) {
  46. return list.Contains(value);
  47. }
  48. public void CopyTo (Array array, int index) {
  49. list.CopyTo(array, index);
  50. }
  51. public int IndexOf (object value) {
  52. return list.IndexOf(value);
  53. }
  54. object IList.this [int index] {
  55. get { return this[index]; }
  56. set { throw new InvalidOperationException("ListSortDescriptorCollection is read only."); }
  57. }
  58. bool IList.IsFixedSize {
  59. get { return list.IsFixedSize; }
  60. }
  61. bool ICollection.IsSynchronized {
  62. get { return list.IsSynchronized; }
  63. }
  64. object ICollection.SyncRoot {
  65. get { return list.SyncRoot; }
  66. }
  67. bool IList.IsReadOnly {
  68. get { return list.IsReadOnly; }
  69. }
  70. IEnumerator IEnumerable.GetEnumerator () {
  71. return list.GetEnumerator();
  72. }
  73. int IList.Add (object value) {
  74. return list.Add(value);
  75. }
  76. void IList.Clear () {
  77. list.Clear();
  78. }
  79. void IList.Insert (int index, object value) {
  80. list.Insert(index, value);
  81. }
  82. void IList.Remove (object value) {
  83. list.Remove(value);
  84. }
  85. void IList.RemoveAt (int index) {
  86. list.RemoveAt(index);
  87. }
  88. }
  89. }