我有这样的东西:
public interface IExample { int GetInteger() T GetAnything(); //How do I define a function with a generic return type??? ^^^^^ }
这可能吗???
解决方法
如果整个界面应该是通用的:
public interface IExample<T> { int GetInteger(); T GetAnything(); }
如果只有方法需要通用:
public interface IExample { int GetInteger(); T GetAnything<T>(); }
原文地址:https://www.jb51.cc/csharp/93382.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。