Adam Anderly

Husband, Father, Developer

  • About
  • Blog
  • Archives
  • Plugins
    • WooCommerce MailChimp
    • Wistia Responsive
  • Contact

Copyright © 2025
Adam Anderly ยท Log in

Expansive 1.5 Released

October 14, 2011 By Adam Leave a Comment

Yesterday, I blogged about my new .NET string expansion library called Expansive.

Today, I made some key changes to, hopefully, make it easier to use and more flexible by providing 4 token style format providers out of the box.

  • Removed the startToken and endToken delimiters that could be set by the consumer as this was unreliable
  • Added 4 new Token Style Formats to pick from:
    • MvcRoute Style “{token}” (default)
    • Razor Style “@token” or “@(token)”
    • NAnt Style “${token}”
    • MSBuild Style “$(token)”

So, the following are all valid:

// MvcRoute-Style (default)
var mvcRouteStyleString = "Hello, {FirstName}".Expand(new { FirstName = "John" });

// Razor-Style
Expansive.DefaultTokenStyle = TokenStyle.Razor;
var razorStyleString = "Hello, @FirstName".Expand(new { FirstName = "John" });

// NAnt-Style
Expansive.DefaultTokenStyle = TokenStyle.NAnt;
var nantStyleString = "Hello, ${FirstName}".Expand(new { FirstName = "John" });

// MSBuild-Style
Expansive.DefaultTokenStyle = TokenStyle.MSBuild;
var msBuildStyleString = "Hello, $(FirstName)".Expand(new { FirstName = "John" });

// all return "Hello, John"

You can also specify the TokenStyle on the call to Expand() such as:

var expandedString = "Hello, @FirstName".Expand(new { FirstName = "John" }, TokenStyle.Razor);

The addition of TokenStyle makes the API a little cleaner and provide 4 popular token formats.

You can of course add your own by grabbing the source on GitHub and opening the hood.

Enjoy!

Share this:

  • Twitter
  • LinkedIn
  • Email
  • Print
  • More
  • Reddit

Filed Under: .NET, ASP.NET MVC, NuGet Tagged With: Expansive, NuGet

RSS

RSS Feed

Subscribe

Enter your email address to subscribe and receive new posts by email.

Find It Here

Top Posts

  • Cross-Cutting Concerns with MediatR Pipeline Behaviors
  • Laravel User Timezone Aware Trait
  • Useful Laravel Model Traits: Gravatar
  • Laravel Transformable - An Eloquent Model Trait for Consumable Models
  • Gravity Forms + Microsoft Dynamics CRM
  • DNS from the command line: dnsimple-cli for Node.js
  • WooCommerce MailChimp 1.2 Released
  • WooCommerce MailChimp Update
  • Purchase Confirmation
  • Transaction Failed

Recent Posts

  • Cross-Cutting Concerns with MediatR Pipeline Behaviors
  • Laravel User Timezone Aware Trait
  • Useful Laravel Model Traits: Gravatar
  • Laravel Transformable – An Eloquent Model Trait for Consumable Models
  • Gravity Forms + Microsoft Dynamics CRM

Categories

  • .NET (12)
  • ASP.NET Core (1)
  • ASP.NET MVC (7)
  • Dependency Injection (3)
  • Laravel (3)
  • Laravel Traits (2)
  • MediatR (1)
  • Node.js (2)
  • NuGet (5)
  • PHP (2)
  • REST (4)
  • Silverlight (5)
  • Uncategorized (3)
  • WordPress (7)
  • WordPress Plugins (7)

Tags

.NET APIs ASP.NET Core ASP.NET MVC Azure Caching cli CRM Dependency Injection dns dnsimple Dynamics Dynamics CRM Expansive Fallback Gravity Forms iPhone Laravel Laravel Traits MailChimp MediatR Microsoft Dynamics CRM MobileMe Node.js NuGet PHP Polly REST Retry Rounding Scrutor Silverlight SimpleMembership sublime-text-2 VS2010 Wistia WooCommerce WordPress WordPress Plugins
  • About
  • Blog
  • Archives
  • Plugins
    • WooCommerce MailChimp
    • Wistia Responsive
  • Contact
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.