Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Delegate-ModifyObject
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { delegate void f(); class Person { public string name; public Person(string name){ this.name = name; } public void modify(){ this.name = "modified"; } } public class Program { public static void Main(string[] args) { Person person = new Person("name"); Console.WriteLine("Name originallty is" + person.name); f f1; f1 = new f(person.modify); f1.Invoke(); Console.WriteLine("Name after is" + person.name); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Prime number
program
BreakNum
Project Euler Problem 7
Lotto unieke getallen
Crystals Plep
Inheritance Gone Wrong Template
12
Find smallest and largest integers in unsorted array
Longest Substring Without Repeating Characters
Please log in to post a comment.