简体   繁体   中英

“TryCF” in Visual Studio 2015 (VB.NET)

I just found the very handy "TRYCF" hotkey in VS2015 - for those unaware, you can type "trycf", hit tab and it lays the following out for you:

           Try

        Catch ex As ArgumentException

        Finally

        End Try

This would be amazing, and would save me a lot of time in my day to day coding, except the default exception type "ArgumentException" is no good for me, I just want to catch generic exceptions: "ex as exception"

Does anyone know how I can set VS2015 up so that the default exception is just an "exception"?

Cheers.

You are invoking a code snippet. You could edit the snippet file and change the <Default> tag.
For VS2015, the path to those snippets is: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VB\\Snippets\\1033\\common code patterns\\exception handling".

A recommended alternative is to copy the subject snippet to your personal snippet folder.

C:\Users\UserName\Documents\Visual Studio 2015\Code Snippets\Visual Basic\My Code Snippets

Then edit it to change the <Default> tag. Also change the <ShortCut> tag so that it does not conflict with the pre-installed VS snippet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM