c# - How can I use a method's (whose argument has been passed by ref) return value in Main() -


i have following c# code:

public class test  {      public string docs(ref innovator inn) ///innovator object defined in   framework of application     {           //// code          string file_name = "filename";         return file_name;     }        public static void main ()/// here i' m trying use above method' s return value inside main()     {          test t = new test();          string file_name1 = t.docs(ref inn);      } } 

this sample code throwing errors.

  1. 'inn' does' t exists in current context,
  2. method has invalid arguments.

why this?

1: 'inn' does' t exists in current context,

you haven't defined inn anywhere in code. should like:

test t = new test(); innovater inn = new innovator(); //declare , (instantiate) string file_name1 = t.docs(ref inn);  

or can inn framework like:

innovater inn = getinnovaterfromtheframework(); 

where method getinnovaterfromtheframework return object framework.

the way passing argument parameter ref keyword right, thing inn doesn't exist in current context.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -