Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Friday, May 8, 2009

ASP.NET MVC Best Material: “NerdDinner” Tutorial, Free for download

Go Scott’s blog:

http://weblogs.asp.net/scottgu/archive/2009/04/28/free-asp-net-mvc-nerddinner-tutorial-now-in-html.aspx 

 

*  Introducing the NerdDinner Tutorial
* How to create a new ASP.NET MVC Project
* How to create a database
* How to build a model with business rule validations
* How to use controllers and views to implement a listing/details UI
* How to provide CRUD (create, read, update, delete) data form entry support
* How to use ViewData and implement ViewModel classes
* How to re-use UI using master pages and partials
* How to implement efficient data paging
* How to secure applications using authentication and authorization
* How to use AJAX to deliver dynamic updates
* How to use AJAX to implement mapping scenarios
* How to enable automated unit testing

[C#] Format a XML string using XmlTextWriter

// a demo string
string xml = "<Root><Eles><Ele>abc</Ele><Ele>123</Ele></Eles></Root>";

System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(xml);

System.IO.StringWriter sw = new System.IO.StringWriter();
using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(sw))
{
writer.Indentation = 2; // the Indentation
writer.Formatting = System.Xml.Formatting.Indented;
doc.WriteContentTo(writer);
writer.Close();
}

// out put the formated xml
Console.WriteLine(sw.ToString());


 


From: http://jack-fx.com/blog/programming-Tag/ 

Thursday, April 2, 2009

C#, Remember to Provide ToString() Method

System.Object.ToString() is one of the most used methods in the .NET environment. You should write a reasonable version for all the clients of your class. Otherwise, you force every user of your class to use the properties in your class and create a reasonable human-readable representation. This string representation of your type can be used to easily display information about an object to users: in Windows Forms, web forms, or console output. The string representation can also be useful for debugging. Every type that you create should provide a reasonable override of this method. When you create more complicated types, you should implement the more sophisticated IFormattable.ToString(). Face it: If you don't override this routine, or if you write a poor one, your clients are forced to fix it for you.

for full article, go http://jack-fx.com/tech-article/106.htm