[英]What does this Method return? (C#)
不久前,我從 Java 轉到 C# 並且我還在學習,今天我在一些代碼中遇到了這個問題。
public async Task<(decimal Price, string NativeCurrency)> GetCurrentStockPrice(string ticker)
我想知道僅基於方法簽名該方法究竟返回什么? 它是否返回兩個值?
這將返回一個元組(decimal Price, string NativeCurrency)
所以你會打電話
var currentStockPrice = await GetCurrentStockPrice("USD") //or whatever the ticket string needs to be instead of "USD"
和
currentStockPrice.Item1 is decimal Price
currentStockPrice.Item2 is string NativeCurrency
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.