예제 #1
0
 internal CountedClassifier(
     PropertyCollection propertyCollection,
     object key,
     Func <IClassifier> createFunc)
 {
     _countedValue = CountedValue <IClassifier> .GetOrCreate(propertyCollection, key, createFunc);
 }
예제 #2
0
 internal CountedTagger(
     PropertyCollection propertyCollection,
     object key,
     Func <ITagger <TTag> > createFunc)
 {
     _countedValue = CountedValue <ITagger <TTag> > .GetOrCreate(propertyCollection, key, createFunc);
 }
예제 #3
0
파일: CountedValue.cs 프로젝트: zf724/VsVim
        internal static CountedValue <T> GetOrCreate(
            PropertyCollection propertyCollection,
            object key,
            Func <T> createFunc)
        {
            CountedValue <T> countedValue;

            if (propertyCollection.TryGetPropertySafe(key, out countedValue))
            {
                countedValue._count++;
                return(countedValue);
            }

            countedValue            = new CountedValue <T>(propertyCollection, key, createFunc());
            propertyCollection[key] = countedValue;
            return(countedValue);
        }