Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 564519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:46:31+00:00 2026-05-13T12:46:31+00:00

I am implementing Visual Studio Add-in and I want my service to be notified

  • 0

I am implementing Visual Studio Add-in and I want my service to be notified when class or method is removed in C# editor. Is there any samples showing how to do that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:46:31+00:00Added an answer on May 13, 2026 at 12:46 pm

    You’re probably looking for code model events exposed via the DTE2 object. For fully featured synchronization you’ll need to handle ElementChanged and ElementAdded events as well:

    public void RegisterCodeModelEvents(DTE2 applicationObject)
    {
       events = (Events2)applicationObject.Events; //events Must be a field
       codeModelEvents = events.get_CodeModelEvents(null); 
    
       codeModelEvents.ElementChanged += CodeModelElementChanged;
       codeModelEvents.ElementAdded += CodeModelElementAdded;
       codeModelEvents.ElementDeleted += CodeModelElementDeleted; // this is it!
    }
    

    Don’t forget to remove the handlers after you finish:

    private void UnregisterCodeModelEvents()
    {
        if (codeModelEvents != null)
        {
            codeModelEvents.ElementAdded -= CodeModelElementAdded;
            codeModelEvents.ElementChanged -= CodeModelElementChanged;
            codeModelEvents.ElementDeleted -= CodeModelElementDeleted;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing a basic authentication WCF service in ASP.NET using Visual Studio 2010.
Implementing a custom Dependency Property on a Framework Element object causes my Visual Studio
I have a Visual Studio 2008 C++ project where I am implementing unit tests
I have a Visual Studio 2008 C# .NET 3.5 project that I am implementing
I'm looking for some pointers on implementing Custom Events in VB.NET (Visual Studio 2008,
Even with F# installed, Visual Studio 2008 (and probably 2010) only provides Add-In project
Using Visual Studio 2010, I developed a WCF service hosted on a web application
I am implementing a SPA tree algorithm and is looking for a Visual Studio
I'm looking for some Visual Studio snippets for implementing style cop rules. For instance
I have a Visual Studio 2008 C# 2.0 CF project where I am implementing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.