コード例 #1
0
ファイル: Camera.cs プロジェクト: typingdinosaur/snapshot
        private SnapshotTypeCollection GetSnapshotTypeCollection(Type type)
        {
            var key = type.GetHashCode();
            SnapshotTypeCollection typeCollection = null;

            if (_typeCollectionHashMap.ContainsKey(key))
            {
                typeCollection = _typeCollectionHashMap[key];
            }

            return(typeCollection);
        }
コード例 #2
0
ファイル: Camera.cs プロジェクト: typingdinosaur/snapshot
        // add a snapshot to the type collection. this is used when we snapshots are being taken for a type
        // and not a reference
        public static void AddToSnapshotTypeCollection <T>(T obj, Snapshot <T> snapshot) where T : ISnapshot
        {
            if (obj == null || snapshot == null)
            {
                return;
            }

            var key = obj.GetType().GetHashCode();

            if (_typeCollectionHashMap.ContainsKey(key))
            {
                _typeCollectionHashMap[key].Add(snapshot);
                return;
            }

            var typeCollection = new SnapshotTypeCollection();

            typeCollection.Add(snapshot);
            _typeCollectionHashMap.Add(key, typeCollection);
        }