Func<TResult> Delegate

Unity3D/C# 2015. 4. 6. 11:18
반응형

https://msdn.microsoft.com/en-us/library/bb534960(v=vs.110).aspx


http://www.dotnetperls.com/func


http://www.codeproject.com/Articles/114854/Looking-in-Func-Delegates


using UnityEngine;
using System.Collections;
using System;

public class FuncTest : MonoBehaviour {
    Func<string> myfunc;

    private static string SayHello()
    {
        return "Hello Dude!!";
    }

	void Start () {
        myfunc = SayHello;
        string returnedString = myfunc();
        Debug.Log(returnedString);
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
반응형
: