This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using System;
using System.Collections.Generic;
using System.Text;
//命名空间同级:调用方只需要引用定义类库就能使用;不需要使用Uing语句引入定义委托的命名空间。
public delegate string NamespaceLevelDelegate();
public delegate string ToLowerDelegate(string source);
namespace Study.DelegateSeries.Core
{
//类同级:最常用和推荐的,可见范围与使用方法与类相同。
public delegate string ClassLevelDelegate();
public class DeclareDelegateDemo
//类内部方法同级:可见范围与使用方法与类中方法相似,调用方须先调用类,后再调用委托。
public delegate string MethodLevelDelegate();
public string GetClassName()
//方法体内:不允许定义委托
return "DeclareDelegateDemo";
}