C# 默认(接口)将返回什么?

C# 默认(接口)将返回什么?,c#,C#,我找到了一些代码,但我不确定返回接口的default的目的是什么 接口由少数类实现 public ISocketDevicePart Parent => default(ISocketDevicePart); public interface ISocketDevicePart { ISocketDevicePart Parent { get; } IEnumerable<ISocketDevicePart> Childs { get; }

我找到了一些代码,但我不确定返回接口的
default
的目的是什么

接口
由少数
实现

 public ISocketDevicePart Parent => default(ISocketDevicePart);

 public interface ISocketDevicePart
 {
     ISocketDevicePart Parent { get; }
     IEnumerable<ISocketDevicePart> Childs { get; }
     IXYOffset Offset { get; set; }
 }
public-ISocketDevicePart-Parent=>default(ISocketDevicePart);
公共接口设备部件
{
ISocketDevicePart父项{get;}
IEnumerable Childs{get;}
IXYOffset偏移量{get;set;}
}

我不确定结果如何。如果它总是返回
null

是,接口类型变量的默认值为
null
(它被视为引用类型)


为了完整起见,您可以在中查看整个
default()
列表。

只需谷歌一下。我只花了0.43秒的时间searching@vasily.sib防御:文档中没有提及
接口
。这可能会让初学者感到困惑。剩下的0.01秒该怎么办呢@瓦西里。sib@PatrickHofman在这里问个问题好吗?当然可以。01秒就够了enough@CamiloTerevinto以防万一:)