MethMVVM and studiomethmvvm of Visual Studio

Source: Internet
Author: User

MethMVVM and studiomethmvvm of Visual Studio
MethMVVM introduction:

Visual Studio Gallery is a solution provided by Microsoft for the extension of Visual Studio. in Visual Studio Gallery, you can find different theme solutions, while MethMVVM is an extension, this extension scheme can be roughly guessed by name to implement MVVM settings. The definition of Visual Studio Gallery is as follows: SNippet for method creaion and MVVM proprties.According to the document, we found that this is actually the Code Snipper on Visual Studio. We can encapsulate it ourselves, but since someone else has extended this Code Snipper for the mvvm mode, we don't have to waste time on our own.

MethMVVM installation:

Before using the tool, install the extension in Visual Studio as follows:

Select contact on the left, enter MethMVVM In the rightmost search box, and click search. The desired extension scheme is displayed in the search result box in the middle. Click the search result, after the installation is complete, Visual Studio is automatically restarted and can be used after the restart!

MethMVVM usage:

Meth-public method (public method)

In the Visual Studio class, enter meth and double-click the Tab to display the Code as follows:

        public int MethodName()        {            throw new NotImplementedException();        }

Methp-private method (private method), which is the same as meth.

Meth2-public method with two parameters (public method with two parameters)

Methp2-private method with two parameters (Private method with two parameters)

Meths-public static method (static method)

Meths2-public static method with two parameters (static method with two parameters)

Propmvvm-mvvm property (attributes that can bind notifications)

Propall-generate typical property definition in C # (full attribute writing in C)

The MethMVVM extension is much more about method definition and propmvvm. The full attribute is included in the Code Snipper of Visual Studio, the definition of propmvvm still requires the implementation of the INotifyPropertyChanged interface notification event.

The OnPropertyChanged method also needs to be implemented manually. The implementation here is a bit tricky.

     public event PropertyChangedEventHandler PropertyChanged;         protected void OnPropertyChanged(string name)        {            PropertyChangedEventHandler handler = PropertyChanged;            if (handler != null)            {                handler(this, new PropertyChangedEventArgs(name));            }        }

 

Summary:

In fact, MethMVVM has limited implementation functions. It is still put into Visual Studio Gallery as an extension and explained in the form of an article, the main reason is that Visual Studio has many ready-made extensions, which can be easily called without writing a lot of code for implementation, we can also find the extended source code in CodePlex. If we can use it to facilitate our Coding, we can share it with you to benefit from it.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.