Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CS1955 C#非发票会员#x27;匹配日期';不能像方法一样使用。I';我遇到这样的错误,谁能帮我一下吗。_C#_Date - Fatal编程技术网

CS1955 C#非发票会员#x27;匹配日期';不能像方法一样使用。I';我遇到这样的错误,谁能帮我一下吗。

CS1955 C#非发票会员#x27;匹配日期';不能像方法一样使用。I';我遇到这样的错误,谁能帮我一下吗。,c#,date,C#,Date,不可开票的成员“Match.Date”不能像方法一样使用。这是我遇到的错误。是否有人可以帮助我看来Date是一个属性,而不是一个方法。如果要为其指定值,请使用 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Matches { class Program {

不可开票的成员“Match.Date”不能像方法一样使用。这是我遇到的错误。是否有人可以帮助我看来
Date
是一个属性,而不是一个方法。如果要为其指定值,请使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Matches
{
    class Program
    {
         static void Main(string[] args)
         {
            MatchesContext db = new MatchesContext();
            Match match = new Match();
            match.M_ID = 4;
            string sdate = "2015-03-10";
            DateTime dt = Convert.ToDateTime(sdate);
            match.Date(sdate);
            match.Team1 = "Kolkata";
            match.Team2 = "Mumbai";
            match.Umpire = "Benson";
            db.Matches.Add(match);
            db.SaveChanges();
            Console.WriteLine("object is created");
            Console.ReadKey();
        } 
    }
}

似乎
Date
是一个属性,而不是一个方法。如果要为其指定值,请使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Matches
{
    class Program
    {
         static void Main(string[] args)
         {
            MatchesContext db = new MatchesContext();
            Match match = new Match();
            match.M_ID = 4;
            string sdate = "2015-03-10";
            DateTime dt = Convert.ToDateTime(sdate);
            match.Date(sdate);
            match.Team1 = "Kolkata";
            match.Team2 = "Mumbai";
            match.Umpire = "Benson";
            db.Matches.Add(match);
            db.SaveChanges();
            Console.WriteLine("object is created");
            Console.ReadKey();
        } 
    }
}

你说得对,非常感谢!你说得对,非常感谢!