Reputation: 1046
I found some code, but I'm not sure what is the purpose of return default
of interface?
The interface
is implemented by few class
es
public ISocketDevicePart Parent => default(ISocketDevicePart);
public interface ISocketDevicePart
{
ISocketDevicePart Parent { get; }
IEnumerable<ISocketDevicePart> Childs { get; }
IXYOffset Offset { get; set; }
}
I'm not sure about result. Should it return null
always?
Upvotes: 4
Views: 100
Reputation: 156968
Yes, the default of an interface-typed variable is null
(it is treated as a reference type).
For completeness, you can view the entire default()
list in the documentation.
Upvotes: 8