• /r/csharp
  • c# enums

    So i have an enum for days(called DAYS) which has 7 of the things (obviously), and i want to show it in a messagebox (it is in a button click event and everything), i had this: for (int i = 0; i < 7; i++) { MessageBox.Show(DAYS[i]); } this just gave an error, any suggestions? […]

  • /r/csharp
  • Question about when async methods are invoked

    I’m an async javascript programmer learning csharp and dotnet. In javascript if you did the following let foo = bar(); console.log(foo); // ‘baz’ bar() gets invoked on the first line and it’s result stored in foo. in the following example in csharp, when is the GetStringAsync function invoked? async Task<int> AccessTheWebAsync() { HttpClient client = […]

  • /r/csharp
  • My moving object should bounce from the other object. help

    I got a logic problem which i can’t figure out(im quite new with c# or any programming language). The purple rectangle should bounce of all sides from the blue. My following Code just reflects it from the top: if (pB_ball.Location.X > pB_1.Location.X && pB_ball.Location.X < pB_1.Location.X + pB_1.Width && pB_ball.Location.Y + pB_ball.Height >pB_1.Location.Y) (they are […]