class obj
{
int typeID; //10 types 0-9
string uniqueString; //this is unique
}
Run Code Online (Sandbox Code Playgroud)
假设有包含100个obj元素的列表,但只有10个唯一的typeID.
是否可以写一个LINQ查询从objs列表中返回10个唯一的int?
我想要的是:
在我的应用程序中,我想为我的电子邮件使用模板。不幸的是,我之前在另一个项目中使用的代码不再起作用。
抛出的错误:
Could not find an IRouter associated with the ActionContext.
If your application is using endpoint routing then you can get a IUrlHelperFactory with dependency injection
and use it to create a UrlHelper, or use Microsoft.AspNetCore.Routing.LinkGenerator.'
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决这个问题,因为我找不到任何方法来注入IUrlHelper. 我不确定为什么甚至需要这样做,因为无论如何它都不在视图中。
字符串渲染方法:
Could not find an IRouter associated with the ActionContext.
If your application is using endpoint routing then you can get a IUrlHelperFactory with dependency injection
and use it to create a UrlHelper, or use Microsoft.AspNetCore.Routing.LinkGenerator.'
Run Code Online (Sandbox Code Playgroud) 我有一个仅包含类名称的字符串列表。我需要使用 Activator 创建它们的实例,但它们都可以位于不同的命名空间中。类将来可以移动到另一个名称空间中,因此我无法对其进行硬编码。