Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace delegate_test
- {
- delegate int PrintHandler( string message );
- public static class Program {
- private static PrintHandler _print;
- private static Test _test;
- private static void Main(string[] args) {
- _test = new Test( );
- _print = _test.Print;
- int res = _print( "Hello, World" );
- Console.WriteLine( $"Return length of _print is {res}" );
- }
- }
- public class Test
- {
- public int Print(string message)
- {
- Console.WriteLine( message );
- return message.Length;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement