C# error CS1061 4

maryam mohammad 1 Reputation point
2022-01-16T15:31:46.457+00:00

I'm trying to develop a simple ping pong game in Visual studio (C#). I'm getting this error in my code.

Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Top' and no accessible extension method 'Top' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) pingpong C:\Users\acer\Desktop\pingpong\Form1.cs 134 Active

165424-screenshot-2022-01-16-202839.png

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
277 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sander van de Velde 29,461 Reputation points MVP
    2022-01-17T00:34:22.027+00:00

    Hello @maryam mohammad ,

    The Visual Studio compiler gives a clear answer: the variable or parameter named "player" is defined as a type that does not have property name "Top".

    Please check the type of your "player" and change the type. Maybe 'casting' could be helpful too.

    0 comments No comments

  2. WhTurner 1,611 Reputation points
    2022-08-09T17:31:33.413+00:00

    The tag "small-basic" is for Technical questions about Microsoft Small Basic, the only text-based language and IDE built for students to learn to code

    Please look for a more fitting tag as your question in not about Small Basic
    e.g. "dotnet-csharp" or even "not-supported""

    0 comments No comments