public CacheDebugEntry(IContextKey key, GlobalPersistentContext value)
            {
                this.Value = value;
                var fields = key.GetType().GetFields(Flags.InstanceAnyDeclaredOnly);

                for (int i = 0; i < fields.Length; i++)
                {
                    switch (i)
                    {
                    case 0:
                        this.Alpha = fields[i].GetValue(key).ToString();
                        break;

                    case 1:
                        this.Beta = fields[i].GetValue(key).ToString();
                        break;

                    case 2:
                        this.Delta = fields[i].GetValue(key).ToString();
                        break;

                    case 3:
                        this.Epsilon = fields[i].GetValue(key).ToString();
                        break;

                    case 4:
                        this.Gamma = fields[i].GetValue(key).ToString();
                        break;
                    }
                }
            }
        public bool Equals(IContextKey x, IContextKey y)
        {
            if (x.GetType() != y.GetType())
            {
                return(false);
            }

            return(x.Key == y.Key);
        }
示例#3
0
 public int GetHashCode(IContextKey obj)
 {
     return($"{obj?.GetType()}-{obj?.Key}".GetHashCode());
 }
示例#4
0
 public bool Equals(IContextKey x, IContextKey y)
 {
     return(x?.GetType() == y?.GetType() && x?.Key == y?.Key);
 }