C# “must declare a body because it is not marked abstract, extern, or partial”

前端 未结 7 602
轻奢々
轻奢々 2020-12-15 15:05

I\'m not sure why i\'m getting this error to be honest.

private int hour
{
    get;
    set
    {
        //make sure hour is positive
        if (value <         


        
7条回答
  •  不知归路
    2020-12-15 15:23

    You DO NOT have to provide a body for getters and setters IF you'd like the automated compiler to provide a basic implementation.

    This DOES however require you to make sure you're using the v3.5 compiler by updating your web.config to something like

     
       
        
        
      
    
    

提交回复
热议问题