Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this method is written to fix Subtitle Edit's GetRegExContextMenu(Combobox/TextBox)
- // make more sense as an extension method.
- public static Action<TControl, string> BuildContextMenuRegex<TControl>()
- {
- var setMethod = typeof(TControl).GetProperty("SelectedText").GetSetMethod();
- var instanceParam = Expression.Parameter(typeof(TControl), "instance");
- var regexTokenParam = Expression.Parameter(typeof(string), "regexToken");
- var lambaExp = Expression.Lambda<Action<TControl, string>>(Expression.Call(instanceParam, setMethod, regexTokenParam), instanceParam, regexTokenParam);
- return lambaExp.Compile();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement