Published articles on other web sites*

Published articles on other web sites*

WPF vs. Silverlight - Part 6 - Debug.WriteLine


 often use System.Diagnostics.Debug.WriteLine to write out values or warnings that I or the developer should be aware of, but not necessarily is an error. However, Silverlight has an overload WPF doesn't have (hey I thought Silverlight was only a subset of WPF?!? - well... if it were we didn't need this blogpost serie).
Here are the overloads in Silverlight:
public static void WriteLine(object value);
    public static void WriteLine(string message);
    public static void WriteLine(string format, params object[] args); //NOT IN WPF! 
and WPF:  
public static void WriteLine(object value);
    public static void WriteLine(string message);
    public static void WriteLine(object value, string category);
    public static void WriteLine(string message, string category); 
Notice that the 3rd method in Silverlight which is equivalent of using string.Format, doesn’t exist in WPF. Therefore it's safer to use WriteLine(string.Format(format,args)) instead which works in both. 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...