Currently viewing the category: ".NET"

Problem:

I have the following line: ShellTile TileToFind = ShellTile .ActiveTiles.First(); to get the first application tile of my Windows Phone 7 application, but First() doesn’t get recognized and I get this error:

Error 2 ‘System.Collections.Generic.IEnumerable<Microsoft.Phone.Shell.ShellTile>’ does not contain a definition for ‘First’ and no extension method ‘First’ accepting a first argument of type ‘System.Collections.Generic.IEnumerable<Microsoft.Phone.Shell.ShellTile>’ could be found (are you missing a using directive or an assembly reference?)

Solution:

Add the following using statement at the top of your .cs file.

using System.Linq;

Problem: SSRS Report Viewer Toolbar is being rendered with a black background.

SSRS Black Toolbar

 

Solution: Make sure the BackColor property of the Report Viewer control is not set to an empty string (BackColor=”") or set the BackColor property to the desired color.

Example: BackColor=”White”

 

Result:

SSRS White Toolbar

 

In practice, you don’t really need a special font to render these type of characters. You can use any sprite font just as you would for displaying basic ASCII characters. For example the ones available for free from Microsoft such as Segoe UI Mono, Andy, Miramonte, etc.
For a complete list, and to download those free font files click here: Redistributable Font Pack

The key is specifying the different character regions in the <CharacterRegions> section of the spritefont xml file, or the individual characters that you want to display. 
For a list of the different regions click Unicode 6.0 Character Code Charts
Now, there are two more important things: one is to specify a default character by setting the DefaultCharacter section of the spritefont xml file, to avoid exceptions when you try to display a character that is not on your defined regions like this:
<DefaultCharacter>?<DefaultCharacter>
And second, some international languages like Japanese and Korean can have thousands of different characters, so including so many characters can be very inefficient or increase the size of your game.
So to build a very efficient game where you only consider characters that you need for your game, rather than manually specifying all the different regions or characters, download this excellent and simple Localization example that uses resource files for the different languages by clicking here.

The carriage return character in XML is represented by “&#xD;” (without the quotes.)

So, try using &#xD;

Example:

<XMLElement>.NET Tips and Tricks&#xD;This other text will be displayed in the next line.</XMLElement>

For reference you might want to look at the Canonical XML Version 1.0 from the W3C at http://www.w3.org/TR/xml-c14n

Sending a request through a SoapHttpClientProtocol and need to see the actual XML that is being generated? Use this little function to save it to disk.

private void saveAsXml(Object serializableObject)

{

using (TextWriter textWriter =

new StreamWriter(String.Format(“{0}.xml”,

serializableObject.GetType().Name)))

  {

    new XmlSerializer(serializableObject.GetType())

.Serialize(textWriter, serializableObject);

  }

}