Neat MVVM – Enums for tokens as flags

Neat MVVM Light tool for the belt – Enums for tokens as flags Enums for tokens allows for Generic calling.

//One of the great things about Mvvmlight, the Messenger 🙂 you could to object and .ToString() in this method too.

public static void SendTo(this string input, MessengerToken token){

Enum.GetValues(typeof (MessengerToken)).Cast<MessengerToken>().ToList().Where(e => token.HasFlag(e)).ToList().ForEach(e =>


Messenger.Default.Send<string>(input, e);});



Add in the Flag Based Enumerator with the Enum Extension Methods :


And you can call many Messenger sends in one swoop.

DoOuputActionPreFormatting(e.Result.Text, (s) =>


   s.SendTo(MessengerToken.MasterText | MessengerToken.MainRegion);



/// You can send to more than one spot at one time.

/// Set your Enum to MainRegion | MasterText to sent to both 🙂



public enum MessengerToken


[Description(“”)] ByType = 0,

[Description(“Main Region Text”)] MainRegion = 1,

[Description(“Master Text”)]MasterText = 2,


Categories: Uncategorized

1 reply »

  1. Good day! I simply wish to give an enormous thumbs up for the great info you may have right here
    on this post. I will probably be coming back to your blog for extra

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: