Advertisement
awsmpshk

Indexator

Dec 12th, 2021
850
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. public int this[T from, T to]
  2.         {
  3.             get
  4.             {
  5.                 if (_adjacencyList[from].ContainsKey(to))
  6.                 {
  7.                     return _adjacencyList[from][to];
  8.                 }
  9.                 else
  10.                 {
  11.                     return Int32.MaxValue;
  12.                 }
  13.             }
  14.             set
  15.             {
  16.                 _adjacencyList[from][to] = value;
  17.             }
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement