更新时间:2022-03-12 04:06:13
示例:
public interface IService1
{
void MyMethod(string text, bool flag = true);
}
public class MyService1a : IService1
{
public void MyMethod(string text, bool flag) { }
}
用法:
IService1 ser = new MyService1a();
ser.MyMethod("A");
传递给 MyService1a
的第二个参数将为 true
,作为接口中的默认参数.
2nd parameter passed to MyService1a
will be true
, as default parameter in interface.