Skip to main content

Microsoft Silverlight

Answered Question Possible missing reference error.RSS Feed

(0)

Spl33n Master
Spl33n M...

Member

Member

1 points

5 Posts

Possible missing reference error.

I get 4 of these errors.

 Error 5 'SilverArcade.SilverSprite.Rectangle' does not contain a definition for 'Contains' and no extension method 'Contains' accepting a first argument of type 'SilverArcade.SilverSprite.Rectangle' could be found (are you missing a using directive or an assembly reference?)

if public void UpdateCannonBalls()

 {

foreach (GameObject ball in cannonballs)

 {

if (ball.alive)

{

ball.position += ball.velocity;

 if (!viewportRect.Contains(new Point

((int)ball.position.X, (int)ball.position.Y)))

{

 ball.alive = false; continue;

 }

What reference do I add? Or what do I need to add to make it work?

Theres also 2 errors for resetElapsedTime.

Same error as above only exception is it says SilverArcade.SilverSprite.Rectangle.

(I am a complete novice and have no knowledge of Silverlight whatsoever.)

Thanks.

mchlsync
mchlsync

Star

Star

14606 points

2,730 Posts

Silverlight MVP
Answered Question

Re: Possible missing reference error.

Spl33n Master:

if (!viewportRect.Contains(new Point((int)ball.position.X, (int)ball.position.Y)))

Maybe, You can try using Any or Where instead of Contains.

Example:

if(!viewportRect.Any( item => (item.positin.X == ball.position.X) && (item.positin.Y == ball.position.Y)))

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Regards,
Michael Sync
Silverlight MVP

Blog : http://michaelsync.net


  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities