小编Chr*_*ris的帖子

从类型参数创建继承的类

我有一个通用控制器,我传递一个只包含属性的类.一切都很好,但......

我想在Controller类中创建另一个继承传递类的类.

有点像:

public class Products
{
    public Int32 ProductID {get; set;}
    public String ProductName {get; set;}
}

public class ProductController : Controller<Products>
{
    public ProductsController() : base("Products", "ProductID", "table", "dbo")
    {
    }
}

public class Controller<T> : IDisposable where T : new()
{
    protected Controller(String tablename, String keyname, String entitytype, String tableschema = "dbo")
    {
        ...
    }

    //How do I create the Recordset class inheriting T
    public class Recordset : T   //<----This is what I don't know how to …
Run Code Online (Sandbox Code Playgroud)

c# generics inheritance class

4
推荐指数
1
解决办法
178
查看次数

使用 Xamarin 在 Windows 上编译 OSX 应用程序

我有一个 Xamarin Mac 应用程序,我需要进行一些更改。就 Windows Visual Studio Xamarin 连接到 Mac Xamarin 而言,我已经让一切正常工作——Mac ssh 代理工作等等。

但是,我如何编译应用程序?当我在 Windows 上构建它时,它会生成一个 .exe 文件。Mac端也应该生成一些东西吗?或者我是否使用该 .exe 文件并以某种方式将其打包到 OSX 应用程序中?

我试图留在我的 Windows 环境中尽可能多地进行编码和构建。

谢谢你。

windows macos xamarin xamarin.mac visual-studio-2015

4
推荐指数
1
解决办法
554
查看次数

DotNetNuke 检索选项卡模块设置

我有一个 tabmoduleID。在本例中,假设为 41。我曾经能够这样做来返回该 tabmoduleid 的所有 tabmodulesettings:

Hashtable Settings2 = ModuleController.GetTabModuleSettings(41);
Run Code Online (Sandbox Code Playgroud)

但是,GetTabModuleSettings 现在已过时,我应该“使用 ModuleInfo 对象的 TabModuleSettings 属性”。

我所拥有的只是 tabmoduleid。我没有 moduleid 或 tabid。

谢谢,克里斯

c# dotnetnuke

2
推荐指数
1
解决办法
226
查看次数

Lambda Expression返回类型问题

为什么第一个和第三个表达式有效但不是第二个?

        var ss = new Func<int>(() => 0); //works
        int x1 = new Func<int>(() => 0); //doesn't work --?Cannot convert source type 'System.Func<int>' to target type 'int'
        int x2 = new Func<string,int>((x) => 0)(""); //works
Run Code Online (Sandbox Code Playgroud)

c# lambda

0
推荐指数
1
解决办法
2687
查看次数