Answer: </P><P align=justify>The equivalent of inout in C# is ref. , as shown in the following </P><P align=justify>example: public void MyMethod (ref String str1, out String str2) </P><P align=justify>{</P><P align=justify>...</P><P align=justify>}</P><P align=justify></P><P align=justify></P><P align=justify>When calling the method, it would be called like this: String s1;</P><P align=justify>String s2;</P><P align=justify>s1 = "Hello";</P><P align=justify>MyMethod(ref s1, out s2);</P><P align=justify>Console.WriteLine(s1);</P><P align=justify>Console.WriteLine(s2);</P><P align=justify></P><P align=justify>Notice that you need to specify ref when declaring the function and calling it.
Tags:Interview Questions, Microsoft, C#,
Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.
Sponsor Advertisement
Hospital Management System Software
Hospital Management System (HMS) Software is developed for multispeciality hospitals, to cover a wide range of hospital administration and management processes with financial accounting, voucher entry, pharmacy, patients module etc features...
No comments:
Post a Comment