[英]Operator '>' cannot be applied to operands of type 'method group' and 'int'
[英]C# Operator '/' cannot be applied to operands of type 'method group' and 'int
此行發生錯誤:
xPoint是Int32
randomsize是int
xPoint = pictureBox1.Width / 2 - randomsize - objectPos.getOffset / 10 * randomsize / 192;
這是顯然導致它的功能,有人能解釋我為什么嗎?
public float getSector()
{
return (float)Math.Floor(x / 192 + 135);
}
public Int32 getOffset ()
{
return (Int32)((x / 192) - getSector() + 135) * 192 * 10;
}
getOffset
是一個方法 ,必須調用。
objectPos.getOffset() / 10
(注意getOffset后的parens)
沒有parens,你指的是功能,而不是它的價值。
如果您打算將getOffset作為屬性,則需要輸入get
和set
關鍵字。
xPoint = pictureBox1.Width / 2 - randomsize - objectPos.getOffset() / 10 * randomsize / 192;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.