It's all about presentation...

My last post, you may notice has code snippets that look somewhat professional. I found a cool online tool called Code2html

It turns this:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage("FROM@domain.foo", "TO@domain.foo", "SYNCHRONOUS MESSAGE", "MESSAGE BODY");
SmtpClient smtp = new SmtpClient();
smtp.Send(message);
}
protected void Button2_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage("FROM@domain.foo", "TO@domain.foo", "ASYNCHRONOUS MESSAGE", "MESSAGE BODY");
SmtpClient smtp = new SmtpClient();
smtp.SendAsync(message, null);
}
protected void Button3_Click(object sender, EventArgs e)
{
System.Web.Mail.SmtpMail.Send("FROM@domain.foo", "TO@domain.foo", "OLD MESSAGE", "MESSAGE BODY");
}
}

to this:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage("FROM@domain.foo", "TO@domain.foo", "SYNCHRONOUS MESSAGE", "MESSAGE BODY");
SmtpClient smtp = new SmtpClient();
smtp.Send(message);
}
protected void Button2_Click(object sender, EventArgs e)
{
MailMessage message = new MailMessage("FROM@domain.foo", "TO@domain.foo", "ASYNCHRONOUS MESSAGE", "MESSAGE BODY");
SmtpClient smtp = new SmtpClient();
smtp.SendAsync(message, null);
}
protected void Button3_Click(object sender, EventArgs e)
{
System.Web.Mail.SmtpMail.Send("FROM@domain.foo", "TO@domain.foo", "OLD MESSAGE", "MESSAGE BODY");
}
}

Comments

Unknown said…
another good one is located at:
http://formatmysourcecode.blogspot.com/
Unknown said…
an even better solution is here:

http://alexgorbatchev.com/wiki/SyntaxHighlighter

and I use it now...
Aaron said…
My latest, best solution is just to put the code samples on gist.github.com and link them directly into the blog. Formatting is all taken care of for you, and people can download and link the gists.

In this example, you would use the number provided after you create the gist in the place of the number below...

<script src="https://gist.github.com/anonymous/7842985.js"></script>

Popular posts from this blog

Database Projects, SQL Unit Tests, and TeamCity

Building nice XML from SQL Server Tables

Brent: Programmer. Gamer. Cheapskate. All around good guy.