Beispiel #1
0
        new public ValueT this[string key]
        {
            set
            {
                switch (Session.This.SourceType)
                {
                case ItemSourceType.DB:
                    throw new Exception("Not implemented");

                case ItemSourceType.FILE:
                    lock (this)
                    {
                        base[key] = SingleValueWorkItem <ValueT> .Create <WorkItemT>(value);

                        return;
                    }

                default:
                    throw new Exception("Undefined SourceType: " + Session.This.SourceType.ToString());
                }
            }
            get
            {
                switch (Session.This.SourceType)
                {
                case ItemSourceType.DB:
                    throw new Exception("Not implemented");

                case ItemSourceType.FILE:
                    lock (this)
                    {
                        WorkItem wi;
                        if (!key2items.TryGetValue(key, out wi))
                        {
                            return(default(ValueT));
                        }
                        return(((SingleValueWorkItem <ValueT>)wi).__Value);
                    }

                default:
                    throw new Exception("Undefined SourceType: " + Session.This.SourceType.ToString());
                }
            }
        }
Beispiel #2
0
        new public ValueT this[string key]
        {
            set
            {
                lock (this)
                {
                    base[key] = SingleValueWorkItem <ValueT> .Create <WorkItemT>(value);

                    return;
                }
            }
            get
            {
                lock (this)
                {
                    WorkItem wi;
                    if (!key2items.TryGetValue(key, out wi))
                    {
                        return(default(ValueT));
                    }
                    return(((SingleValueWorkItem <ValueT>)wi).__Value);
                }
            }
        }