我是編碼新手,我有一個簡單的問題,我無法在任何地方找到解決方案。我所需要的只是將信息從一個傳遞void到另一個。我試圖找到一個解決方案,但許多解決方案繼續用于將信息從類傳遞到類和腳本到腳本,這并不是我所需要的,而且沒有一個有效。現在的代碼是這樣的:public static void Main(string[] args){ GetVoid.DoCheck();}public void GenerateInformation(){ DateTime StoredDateTime; //Code that does something StoredDateTime = //Date generated from the rest of the code not included}public void DoCheck(){ DateTime CheckedDateTime; GenerateInformation(); CheckedDateTime = StoredDateTime; //Rest of the code for that void}我的最終目標是日期,所以只需存儲在另一個日期中,DateTime但我得到了錯誤當前上下文中不存在名稱“StoredDateTime”。據我所知,這是因為它不知道是什么StoredDateTime,為了解決這個問題,我需要將信息從一個虛空傳遞到另一個虛空。但我該怎么做呢?
如何將信息從一個虛空傳遞到另一個虛空?
慕婉清6462132
2022-06-19 09:53:25