Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ValueRef
- {
- public class Student
- {
- public string Name { get; set; }
- public bool Enrolled { get; set; }
- }
- public class AnotherClass
- {
- public static void Method(ref Student st)
- {
- st.Name = "Narine";
- st.Enrolled = true;
- st = new Student();
- st.Enrolled = false;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Student an = new Student()
- {
- Name = "Karine",
- Enrolled = false
- };
- AnotherClass.Method(ref an);
- Console.WriteLine(an.Enrolled);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement