whenever I copy the contents of Visual Studio 2010 to my blog, it appears as a normal black font, with the formatting and color of the C# code not applying to my Google blogger. How do I fix this problem?
Here's an example of my code:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BookStore.Models
{
public class Book
{
[Key]
public int Id { get; set; }
[Required]
[MaxLength(30)]
public string Title { get; set; }
public string Authers { get; set; }
[Column("Year")]
[Display(Name = "Publish Year")]
public string publishYear { get; set; }
[Column("Price")]
[Display(Name = "Price")]
public decimal BasePrice { get; set; }
}
}
I want this to be highlighted as C# code.
I have tried the following with another platform but not with Blogger. I am not sure whether it will serve your purpose. But it is definitely worth a try:
Copy and paste directly from Visual Studio into the rich text editing field will not preserve the syntax highlighting. I have no clue why.