locked
Object Test Bench: Invoke method that expects string[] RRS feed

  • Question

  • From Class View, is it possible to invoke a static method that expects a string[] parameter?

    I tried to, but I can't figure out the correct syntax to pass the parameter in. {"a", "b"} does not work, I get: "Type Mismatch: 'System.String[]' expected".
    Wednesday, August 16, 2006 10:47 PM

Answers

  • First you have to create String[] object. You can create this by using "Immediate Window". Immediate Window can be viewed by clicking on Debug --> Windows --> Immediate of Visual Studio 2005 menu bar.

    In the Immediate Window, create String[] object by typing

    String[] args = {"abc", "xyz"}; // or any valid syntax to create String[] object

    This will place args object in Object Test Bench. Now invoke your static method that expects String[]. You can choose "args" from the drop down of Parameter Value.

     

    Monday, August 21, 2006 5:34 AM

All replies

  • First you have to create String[] object. You can create this by using "Immediate Window". Immediate Window can be viewed by clicking on Debug --> Windows --> Immediate of Visual Studio 2005 menu bar.

    In the Immediate Window, create String[] object by typing

    String[] args = {"abc", "xyz"}; // or any valid syntax to create String[] object

    This will place args object in Object Test Bench. Now invoke your static method that expects String[]. You can choose "args" from the drop down of Parameter Value.

     

    Monday, August 21, 2006 5:34 AM
  • Thank you!
    Monday, August 21, 2006 9:34 AM