System.Threading.Interlocked.Increment C# (CSharp) Метод

Increment() приватный Метод

private Increment ( int &location ) : int
location int
Результат int
        public static extern int Increment(ref int location);

Usage Example

Пример #1
0
        protected override void Initialize()
        {
            base.Initialize();

            // Subscribe to the solution events
            this.solutionListeners.Add(new SolutionListenerForProjectReferenceUpdate(this));
            this.solutionListeners.Add(new SolutionListenerForProjectOpen(this));
            this.solutionListeners.Add(new SolutionListenerForBuildDependencyUpdate(this));
            this.solutionListeners.Add(new SolutionListenerForProjectEvents(this));

            foreach (SolutionListener solutionListener in this.solutionListeners)
            {
                solutionListener.Init();
            }

            try
            {
                // this block assumes that the ProjectPackage instances will all be initialized on the same thread,
                // but doesn't assume that only one ProjectPackage instance exists at a time
                if (Interlocked.Increment(ref _singleFileGeneratorNodeExtenderReferenceCount) == 1)
                {
                    ObjectExtenders objectExtenders = (ObjectExtenders)GetService(typeof(ObjectExtenders));
                    _singleFileGeneratorNodeExtenderProvider = new SingleFileGeneratorNodeExtenderProvider();
                    string extenderCatId = typeof(FileNodeProperties).GUID.ToString("B");
                    string extenderName  = SingleFileGeneratorNodeExtenderProvider.Name;
                    string localizedName = extenderName;
                    _singleFileGeneratorNodeExtenderCookie = objectExtenders.RegisterExtenderProvider(extenderCatId, extenderName, _singleFileGeneratorNodeExtenderProvider, localizedName);
                }
            }
            finally
            {
                _initialized = true;
            }
        }
All Usage Examples Of System.Threading.Interlocked::Increment