小编Sac*_*nth的帖子

异步方法意味着什么?

什么是异步方法.我想我知道,但我一直把它与并行性混淆.我不确定异步方法和并行方法之间有什么区别.

使用线程类和异步类之间有什么区别?

编辑

一些代码演示异步,线程和并行之间的区别将是有用的.

c# asynchronous

16
推荐指数
3
解决办法
1万
查看次数

存储过程T-SQL如果是布尔检查

任何知道的人都很容易.在TSQL存储过程中,如何编写比较bool值的if语句.习惯于C#的时间过长,我会用花括号,圆括号和各种各样的东西,我觉得我弄错了.

t-sql if-statement

15
推荐指数
1
解决办法
6万
查看次数

属性表达式无效.表达式应代表属性

我有这两个实体

public class Song : IPathHavingEntity
    {
        public int Id { get; set; }
        [Required]
        public string Path { get; set; }
        [Required]
        public virtual Album Album { get; set; }
        [Required]
        public int TrackNumber { get; set; }
    }

public class Album : IPathHavingEntity
    {
        public int Id { get; set; }
        [Required]
        public string Path { get; set; }
        public virtual IEnumerable<Song> Songs { get; set; }
        [Required]
        public int AlbumNumber { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

Path在 …

entity-framework-6

15
推荐指数
3
解决办法
1万
查看次数

MVC:没有为此对象定义的无参数构造函数

我有以下控制器定义

public class FeaturedAccommodationController : Controller
{
   ...

   public FeaturedAccommodationController(IAccommodationService accommodationService)
   {
      ...
   }

   public ActionResult Index(int page = 1)
   {
      ...
   }
   ...
}
Run Code Online (Sandbox Code Playgroud)

我有一个链接,我用它来调用这个索引操作方法

@Html.ActionLink("Featured Accommodations", "Index", "FeaturedAccommodation")
Run Code Online (Sandbox Code Playgroud)

出于某种原因,当我点击此链接时,我收到以下错误.这里有什么问题?

No parameterless constructor defined for this object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.

Source …
Run Code Online (Sandbox Code Playgroud)

razor asp.net-mvc-3

14
推荐指数
3
解决办法
5万
查看次数

是否有一种编程语言,其中类型可以通过值进行参数化?

参数化类型(如C++模板)是一件好事,但大多数时候它们只能通过其他类型进行参数化.

但是,在C++中有一个特殊情况,可以通过整数对模板进行参数化.例如,固定长度数组是一个典型的用例:

template<typename T, int SIZE> class FixedArray 
{ 
    T m_values[SIZE]; 

public: 
    int getElementCount() const { return SIZE; }

    T operator[] (int i) const { 
        if (i<0 || i>=SIZE) 
            throw;
        else 
            return m_values[i]; 
    }  
};

void f()
{
    FixedArray<float, 5> float_array; // Declares a fixed array of 5 floats. 
    //The size is known at compile time, and values are allocated on the stack.
}
Run Code Online (Sandbox Code Playgroud)

在C++中只允许使用常量整数和指针,但我认为使用任何值进行参数化(浮点数,类实例等)可能会很有趣.这可以允许在编译时表达前提条件(通常在文档中非正式指定),并在运行时自动检查它们.例如,这是假设的C++方言中的"Interval"模板:

// Interval of type T between TMin and TMax. 
template<typename T, T TMin, T TMax> …
Run Code Online (Sandbox Code Playgroud)

type-systems programming-languages

13
推荐指数
2
解决办法
393
查看次数

使用Add-Migration时,程序包管理器控制台崩溃

我正在使用程序包管理器控制台将迁移添加到我的数据库,由于某种原因它只是冻结并且什么也不做.停止并继续使用它的唯一方法是使用任务管理器关闭Visual Studio.这是一个已知的问题?

ef-migrations

13
推荐指数
1
解决办法
2365
查看次数

十进制超出范围

我正在尝试将小数存储140.2705893427到SQL Server 2012表中.该列的数据类型为decimal(12, 10)但我收到错误:

{"Parameter value '140.2705893427' is out of range."}
Run Code Online (Sandbox Code Playgroud)

为什么是这样?

c# sql-server-2012 entity-framework-5

13
推荐指数
1
解决办法
5676
查看次数

表单中的取消按钮

我在表单中有一个取消按钮:

@using (Html.BeginForm("ConfirmBid","Auction"))
        {
          some stuff ...

                    <input type="image" src="../../Content/css/img/btn-submit.png" class="btn-form" />
                    <input type="image" src="../../Content/css/img/btn-cancel.png" class="btn-form" />

        }
Run Code Online (Sandbox Code Playgroud)

问题是当我点击它时,我希望此按钮转到特定视图.我该怎么做呢?

c# button cancel-button razor asp.net-mvc-3

12
推荐指数
2
解决办法
3万
查看次数

配置错误:System.Web.Helpers

我将一个站点部署到服务器,我收到此错误.为什么我这样做?

Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error: 


Line 16:       <assemblies>
Line 17:         <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Line 18:         <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Line 19: …
Run Code Online (Sandbox Code Playgroud)

iis-6 web-config .net-4.0 asp.net-mvc-3

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

DateTime.Parse日期格式

因此,我有一个日期表示为字符串

20130116154407
Run Code Online (Sandbox Code Playgroud)

我在这上面调用了DateTime.Parse但它失败了.如何将其转换为DateTime?顺便提一下,时区是CET.

编辑

到目前为止,所提供的解决方案非常有用,但似乎它们不支持24小时时钟,仍在寻找可行的解决方案.

编辑2

格式正确

DateTime.ParseExact(str, "yyyyMMddHHmmss", CultureInfo.InvariantCulture)
Run Code Online (Sandbox Code Playgroud)

谢谢,

萨钦

c# datetime

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