Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何维护作为参数传递的调用函数中的变量值以调用函数?
使用 ref 关键字,这将保留您的变量。
private void method() { int a = 10; function(ref a); } private void function(ref int a) { //do work and change value of a }