简体   繁体   中英

Run instance method with visual studio command while debugging

I was wondering if there is a trick somewhere to be able to run methods with a visual studio command or something.

For instance, lets say I created a new instance of type Connection in void Main and saved it to a static variable within the Program class. Now, lets say my program is running under the VS2012 debugger, and i would like to arbitrarily execute the method Connection.Blah(int, string) on the instance of Connection that is held up in my Program class from visual studio, with no prior code to do so.

Is there a way to do this?

Yes. Use the Immediate window . Punch in FullyQualified.Name.To.Program.staticvar.Blah(0, "foo") , hit enter.

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