Showing posts with label format. Show all posts
Showing posts with label format. Show all posts

Thursday, February 15, 2007

C# code HTML formatting continued...

Testing yet another tool available here. As you can see the output is much better, just like in Visual Studio.

However, when using it within Blogger one needs to embed the CSS stylesheet directly into one's header section.


private PortFolioReportInfo2[] GetDataList(BLContext c)
{
if (Session["UsersPortfolioReportList"] == null)
{
PortfolioHandler ph = new PortfolioHandler(c);
PortFolioReportInfo2[] list = ph.GetUsersFileList();
Session["UsersPortfolioReportList"] = list;
return list;
}
else
{
return (PortFolioReportInfo2[])Session["UsersPortfolioReportList"];
}
}

Wednesday, February 14, 2007

C# code highlighting in HTML

Just testing C# code highlighting to make code samples more readable. The C# code below has been processed with this tool. Thanks Thomas Johansen and csharpfriends.com.

List<string> portfolioIds = new List<string>();
for (int i = 0; i < temp.Length; i++)
{
if (!portfolioIds.Contains(temp[i].PortfolioId))
portfolioIds.Add(temp[i].PortfolioId);
}
List<PortFolioReportInfo2>[] portfolios = new List<PortFolioReportInfo2>[portfolioIds.Count];
for (int p = 0; p < portfolioIds.Count; p++)
{
portfolios[p] = new List<PortFolioReportInfo2>();
for (int i = 0; i < temp.Length; i++)
{
if (String.Equals(temp[i].PortfolioId, portfolioIds[p])) portfolios[p].Add(temp[i]);
}
}