作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这个错误:
Severity Code Description Project File Line
Error CS0246 The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
在此方法的方法签名上:
public static void SendMessage(string queuName, T objeto)
{
QueueClient Client =QueueClient.CreateFromConnectionString(connectionString, "Empresa");
BrokeredMessage message = new BrokeredMessage(objeto);
message.ContentType = objeto.GetType().Name;
Client.Send(new BrokeredMessage(message));
}
最佳答案
public static void SendMessage<T>(string queuName, T objeto)
{
QueueClient Client =QueueClient.CreateFromConnectionString(connectionString, "Empresa");
BrokeredMessage message = new BrokeredMessage(objeto);
message.ContentType = objeto.GetType().Name;
Client.Send(new BrokeredMessage(message));
}
关于c# - 如何将泛型类型(T)作为参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31302356/
我是一名优秀的程序员,十分优秀!