public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) { EnvDTE.TextSelection ts = DTE.ActiveWindow.Selection as EnvDTE.TextSelection; if (ts == null) { throw new Exception("No Selection"); } EnvDTE.CodeParameter codeParam = ts.ActivePoint.CodeElement[vsCMElement.vsCMElementParameter] as EnvDTE.CodeParameter; if (codeParam == null) { throw new Exception("Not Parameter"); } System.Type tClass = GetTypeByName(DTE, package, codeParam.Type.AsFullName); string properties = System.Environment.NewLine; foreach (var p in tClass.GetProperties()) { properties += codeParam.Name + "." + p.Name + System.Environment.NewLine; } // Move into the method and dump the properties there ts.FindText("{"); ts.Insert("{" + properties); }
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) { EnvDTE.TextSelection ts = DTE.ActiveWindow.Selection as EnvDTE.TextSelection; if (ts == null) { return; } EnvDTE.CodeParameter codeParam = ts.ActivePoint.CodeElement[vsCMElement.vsCMElementParameter] as EnvDTE.CodeParameter; if (codeParam == null) { return; } System.Type tClass = GetTypeByName(DTE, package, codeParam.Type.AsFullName); string properties = ""; foreach (var p in tClass.GetProperties()) { properties += codeParam.Name + "." + p.Name + System.Environment.NewLine; } System.Windows.Clipboard.SetText(properties); System.Windows.MessageBox.Show(properties); }