Window.Title doesn't set the title

Hi there,

I’m trying to learn som MonoGame.
Just installed the 3.5 version for Windows and use Visual Studio.

I have created a simple “chase the square”-game from a book (a Universal Windows project). It works nicely, but this line from the game’s Update method has no effect:

Window.Title = $"Score: {_playerScore}";

The window’s title is left to the default. How can that be?

1 Like

Hi,

I have never seen $ to be used with string. How about this:
Window.Title = string.Format(“Score: {0}”, _playerScore);

Actually, the “$” sign is a new feature of C# 6 called Interpolated Strings which works almost like string.Format, see here:


or here:
http://geekswithblogs.net/BlackRabbitCoder/archive/2015/03/26/c.net-little-wonders-string-interpolation-in-c-6.aspx

That is a pretty neat C# feature… I need to remember to use that more in the future.

Could you try just saying Window.Title = “hello world” + playerscore;
? If so then it is probably a problem with $ or what .net version your using etc…