晚上好,我在vb.net的项目中使用了ac#编写的库,除了一些命令以外完美地工作,使它们工作我必须下载源库代码并从长整数中更改变量的类型,但是我试图重新编译它有多少我得到了这两个错误:
错误1在类,结构或接口的成员声明中无效的令牌'='C:\ Users \ Luca \ Desktop \ TLSharp-master \ TeleSharp.TL \ TLMethod.cs 23 48 TeleSharp.TL < /强>
错误2类,结构或接口成员中的标记'='无效C:\ Users \ Luca \ Desktop \ TLSharp-master \ TeleSharp.TL \ TLMethod.cs 24 48 TeleSharp.TL < /强>
参考此代码:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TeleSharp.TL;
namespace TeleSharp.TL
{
public abstract class TLMethod : TLObject
{
public abstract void deserializeResponse(BinaryReader stream);
#region MTPROTO
public long MessageId { get; set; }
public int Sequence { get; set; }
public bool Dirty { get; set; }
public bool Sended { get; private set; }
public DateTime SendTime { get; private set; }
public bool ConfirmReceived { get; set; }
public virtual bool Confirmed { get; } = true;
public virtual bool Responded { get; } = false;
public virtual void OnSendSuccess()
{
SendTime = DateTime.Now;
Sended = true;
}
public virtual void OnConfirm()
{
ConfirmReceived = true;
}
public bool NeedResend
{
get
{
return Dirty || (Confirmed && !ConfirmReceived && DateTime.Now - SendTime > TimeSpan.FromSeconds(3));
}
}
#endregion
}
}
我对C#有一个非常肤浅的知识,我该如何解决这些错误呢?
答案 0 :(得分:2)
更改这些属性
public virtual bool Confirmed { get; } = true;
public virtual bool Responded { get; } = false;
可能你想这样做:
public virtual bool Confirmed { get {return true; } }
public virtual bool Responded { get {return false; } }
根据c#的版本,这些属性会引发错误。