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.
- 'inn' does' t exists in current context,
- 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
Post a Comment