I like to create a funktion which has a generic parameter:
public interface IInterfaceMethod< out T0> : where T0 : IInterface2
So i created a new CodeTypeParameter and added this as constraint. So how can i create the "out" value?
Thanks
You can only put the T0
generic type in "out" positions inside this interface:
You can not:
out
parameters) So this is an example of your interface:
public interface IInterfaceMethod<out T0>
where T0 : IInterface2
{
T0 GetterOnly { get; }
T0 MethodReturnValue();
}
while this is illegal:
public interface IInterfaceMethod<out T0>
where T0 : IInterface2
{
T0 GetterAndSetter { get; set; }
void MethodParameter(T0 value);
void MethodOutParameter(out T0 value);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.