ref (C# reference)
You use the ref
keyword in the following contexts:
- In a method signature and in a method call, to pass an argument to a method by reference.
- In a method signature, to return a value to the caller by reference. For more information, see
ref return
. - In a declaration of a local variable, to declare a reference variable.
- As the part of a conditional ref expression or a ref assignment operator.
- In a
struct
declaration, to declare aref struct
. For more information, see theref
structure types article. - In a
ref struct
definition, to declare aref
field. For more information, see theref
fields section of theref
structure types article.
ทํางานร่วมกับเราใน GitHub
แหล่งที่มาสำหรับเนื้อหานี้สามารถพบได้บน GitHub ซึ่งคุณยังสามารถสร้างและตรวจสอบปัญหาและคำขอดึงข้อมูลได้ สำหรับข้อมูลเพิ่มเติม ให้ดูคู่มือผู้สนับสนุนของเรา
คำติชม
https://aka.ms/ContentUserFeedback
เร็วๆ นี้: ตลอดปี 2024 เราจะขจัดปัญหา GitHub เพื่อเป็นกลไกคำติชมสำหรับเนื้อหา และแทนที่ด้วยระบบคำติชมใหม่ สำหรับข้อมูลเพิ่มเติม ให้ดู:ส่งและดูข้อคิดเห็นสำหรับ