logo
  • 教程列表
  • SO官方文檔
  • 具有多個返回值的函式
    • 匿名物件動態關鍵字解決方案
    • 元組解決方案
    • 參考和輸出引數
  1. StackOverflow 文件
  2. C# Language 教程
  3. 具有多個返回值的函式
  4. 元組解決方案

元組解決方案

Created: November-22, 2018

你可以使用兩個模板引數 Tuple<string, MyClass> 從函式返回 Tuple 類的例項:

public Tuple<string, MyClass> FunctionWith2ReturnValues ()
{
    return Tuple.Create("abc", new MyClass());
}

並閱讀如下的值:

Console.WriteLine(x.Item1);
Console.WriteLine(x.Item2);
  • 參考和輸出引數
  • 匿名物件動態關鍵字解決方案

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明