I have written this helper method to get the properties from a class, but it also gets the private properties. How can I get public properties only?
public IEnumerable<string> GetProperties(CodeClass @class)
{
return @class.Members.Cast<CodeElement>()
.Where(ce => ce.Kind == vsCMElement.vsCMElementProperty)
.Select(ce => ce.Name)
.ToList();
}
Update: You can look here for a more in depth blog about this technique http://andersmalmgren.com/2014/02/05/typed-javascript-contracts-using-t4-templates/
@Ash's comment lead me to the answer. So now I have this T4 template
It outputs a JS that looks like this, code completion works from VS2012 with Resharper
Update Code completion didnt work with old solution, had to add the staticly declare each closure seperate for it to work correctly