Sunday, October 25, 2009

VS Tips & Tricks

If a class inherits an Interface, right-click on the interface adds “Implement Interface” to pop-up menu:



After selecting “Implement Interface”, proper function stubs are added:

    public class ttt : IApplicationSettingsProvider
    {
        #region IApplicationSettingsProvider Members

        public SettingsPropertyValue GetPreviousVersion(SettingsContext context, SettingsProperty property)
        {
            throw new NotImplementedException();
        }

        public void Reset(SettingsContext context)
        {
            throw new NotImplementedException();
        }

        public void Upgrade(SettingsContext context, SettingsPropertyCollection properties)
        {
            throw new NotImplementedException();
        }

        #endregion
    }


Another trick that they use is creating default constructor:
In the class type ctor:

    public class ttt : IApplicationSettingsProvider
    {
        ctor
    }
Then press Tab:

    public class ttt : IApplicationSettingsProvider
    {
        public ttt()
        {

        }
    }

No comments:

Post a Comment