Saturday, December 12, 2015

Class Widget: Create Method from Caller

Its feature is pretty self-explanatory, creating a method into the same class from a highlighted caller. The caller is not a real caller at that moment, of course, since no method definition exists yet for the caller. That is exactly what the Create Method from Caller class widget is supposed to help.

If something like the following is written anywhere in a class,

 int age = 35;   
double salary = 1000000;   
string name = "peter";   
Class1 person = CreatePerson(age, salary, name);

        the cursor is inside the CreatePerson caller, and the Create Method from Caller command is called up, the following method will be created:

 public Class1 CreatePerson(int age, double salary, string name)
 {
   return default(Class1);
 }

The code will be able to compile right away. Isn't it terrific?

Enjoy!

No comments:

Post a Comment