String Format – Online Silverlight Reference

My coworker wrote a interesting silverlight tool ,which allows to you test and play with string formatting syntax.Or you can use it as a interactive online reference when you deal with strings and localization.

string-format

 

Check out string format tool

 

 

Tag property without inheritance

Tag property is very often used to store a data associated with an object. The simple way to add support for Tag property is to create a base class with the Tag property .I don’t like this solution – the reason is simple .Sometimes I want to inherit from an existing class that doesn’t have the Tag property and I can’t change its source code .In WPF we have dependency properties that can help us in this case.

MyControl cnt = new MyControl();
cnt.SetValue(FrameworkElement.TagProperty, new Info() );

One problem – we still need to inherit from DependecyObject class.

The helper class below uses extension methods – to provide the tag functionality for your classes.

Of course, for better performance, you may change the dictionary(and methods) to be more type specific .

/// Implements tag functionality
static class TagHelper
{

    /// Adds the tag
    public static void AddTag(this object element, object tag)
    {
        if (!Tags.ContainsKey(element))
        {
            Tags.Add(element, tag);
        }
    }

    /// Removes the tag for the specified element.
    public static void RemoveTag(this object element )
    {
        Tags.Remove(element);
    }

    ///
    /// Clears the tags.
    ///
    public static void ClearTags()
    {
        Tags.Clear();
    }

    /// Gets the tag for the specified element.
    public static object Get(this object element)
    {
        object tag;
        Tags.TryGetValue(element, out tag);

        return tag;
    }

    private static readonly Dictionary<object, object> Tags = new Dictionary<object, object>();
}

StickyNotes – VS 2008 Addin

StickyNotes is a Visual Studio Addin that provides sticky notes capabilities to project and project items inside VS 2008 IDE.

scn1

Download StickyNotes Addin

 

Technorati Tags: ,,

PowerCommands Addin for Visual Studio 2008

PowerCommands is an addin for Visual Studio 2008 that contains additional command menu functions for the IDE that most developers would use regularly.
The PowerCommands Addin is available along with source code and documentation.

Below is a list of the features that you will currently find on in PowerCommands Addin for Visual Studio 2008.

  1. Collapse Projects This command collapses a hierarchy in the solution explorer starting from the root selected node.
  2. Copy Class This command copies a selected class entire content to the clipboard.
  3. Paste Class This command pastes a class entire content from the clipboard.
  4. Copy References This command copies a reference or set of references to the clipboard.
  5. Paste References This command pastes a reference or set of references from the clipboard.
  6. Copy As Project Reference-This command copies a project as a project reference to the clipboard.
  7. Edit Project File-This command opens the MSBuild project file for a selected project inside Visual Studio.
  8. Open Containing Folder-This command opens a Windows Explorer window pointing to the physical path of a selected item.
  9. Open Command Prompt-This command opens a Visual Studio command prompt pointing to the physical path of a selected item.
  10. Unload Projects-This command unloads all projects in a solution.
  11. Reload Projects-This command reloads all unloaded projects in a solution.
  12. Remove and Sort Using’s-This command removes and sort using statements for all classes given a project.
  13. Extract Constant-This command creates a constant definition statement for a selected text.
  14. Clear Recent File List-This command clears the Visual Studio recent file list.
  15. Clear Recent Project List-This command clears the Visual Studio recent project list.
  16. Transform Templates-This command executes the associated custom tool with text templates items.
  17. Close All- This command closes all documents.

Download PowerCommands for Visual Studio 2008

 

Technorati Tags: ,,

Measure and record C# code metrics.

SourceMonitor measures and records source code metrics. SourceMonitor parses ASCII source code looking for countable metrics items. As these items are identified, their counts are accumulated for each source code file, and within each function or method. These metrics are then accumulated into summary metrics for all files in each checkpoint.If you develop software with Visual Studio, you can add items to your tools menu in Visual Studio that invoke SourceMonitor. You can also operate SourceMonitor from a batch file using commands stored in a text file. SourceMonitor measures metrics for source code written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML.Exports metrics to XML or CSV for further processing with other tools.

C# Metrics

  1. Statements
  2. Percent Comment Lines
  3. Percent Documentation Lines
  4. Classes, Interfaces, Structs
  5. Methods per Class
  6. Statements per Method
  7. Calls per Method
  8. Maximum Method Complexity
  9. Maximum Block Depth
  10. Average Block Depth
  11. Average Complexity

Download SourceMonitor

 

Technorati Tags: ,,


Page 4 of 59« First...23456...102030...Last »