CS1955 C#非发票会员#x27;匹配日期';不能像方法一样使用。I';我遇到这样的错误,谁能帮我一下吗。
不可开票的成员“Match.Date”不能像方法一样使用。这是我遇到的错误。是否有人可以帮助我看来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 {
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();
}
}
}
你说得对,非常感谢!你说得对,非常感谢!