Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Incapsulation.Weights
  8. {
  9. public class Indexer
  10. {
  11. private double[] Array;
  12. public readonly int Position;
  13. private double[] NewArray;
  14. public int Length
  15. {
  16. get
  17. {
  18. return NewArray.Length;
  19. }
  20. }
  21.  
  22. public double this[int index]
  23. {
  24. get {
  25. if (index < 0 || index > NewArray.Length)
  26. throw new IndexOutOfRangeException();
  27. return NewArray[index];
  28. }
  29. set {
  30. NewArray[index] = value;
  31. }
  32. }
  33. public Indexer(double[] array, int position, int count)
  34. {
  35. if (position < 0 || count < 0 || count > array.Length)
  36. throw new ArgumentException
  37. Position = position;
  38. Array = array;
  39. NewArray = arr.Skip(position).Take(count).ToArray();
  40.  
  41.  
  42.  
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement