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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Feb 6, 2022, 7:12 AM EST
Mahesh ChandRank #1 · 393.3K reputationPosted Feb 6, 2022, 9:37 PM EST
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 MenothRank #118 · 18.4K reputationPosted Feb 6, 2022, 7:02 AM EST