Hi
How can i return this? Thanks
static string MyMethod(int x)
{ return "{0} x {1} = {2}=", x, 2, x * 2; }
static void Main(string[] args)
{ Console.WriteLine(MyMethod(7)); }
Hi
How can i return this? Thanks
static string MyMethod(int x)
{ return "{0} x {1} = {2}=", x, 2, x * 2; }
static void Main(string[] args)
{ Console.WriteLine(MyMethod(7)); }
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Muhammad Imran AnsariPosted Feb 6, 2022, 12:12 PM
Mahesh ChandPosted Feb 7, 2022, 2:37 AM
You can also use out and ref parameters to get multiple values out from a method, different types ofcourse. That will be more efficient because you're not converting everything to a string.
Rajeesh MenothPosted Feb 6, 2022, 12:02 PM