Harri's profilePainKiller´s C# CornerBlogListsNetworkMore Tools Help

Blog


    Guidlines

    Running FxCop on your assemblys is a good practice to keep your code clean and efficient. FxCop not only finds code that break “best practice” rules it also suggest´s how to correct them.

    Some tips:

    Properties should not return arrays

    "Properties that return arrays are prone to code inefficiencies.
    Consider using a collection or making this a method.
    See the design guidelines for more information."

    Specify format provider

    "If an overload exists that takes an IFormatProvider
    argument, it should always be called in favor of an
    overload that does not. Some methods in the runtime
    convert a value to or from a string representation
    and take a string parameter that contains one or more
    characters, called format specifiers, which indicate
    how the value is to be converted. If the meaning of
    the format specifier varies by culture, a formatting
    object supplies the actual characters used in the string
    representation. In scenarios where sorting and comparison
    behavior should never change between cultures, specify
    CultureInfo.InvariantCulture, otherwise, specify CultureInfo.CurrentCulture."

    Example:
    LastRefresh = Convert.ToInt64(marketFields[10], CultureInfo.InvariantCulture)

    Download FxCop : http://www.microsoft.com/downloads/details.aspx?familyid=3389F7E4-0E55-4A4D-BC74-4AEABB17997B&displaylang=en

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://csharp3.spaces.live.com/blog/cns!E0D0E097982463FD!187.trak
    Weblogs that reference this entry
    • None