Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Generate Code Snippet at runtime

$
0
0

The Problem is the following:
I created an attribute, that can be added to a class multiple times:

[Parameter("Name1",typeof(String))]
[Parameter("Name2",typeof(String))]
class asdf...

I would like to create a CodeSnippet that automatically recognizes how many attributes are added to my class "asdf"(in my example 2 times) and generates the following code:
[ParamValue("Name1","name1")]
[ParamValue("Name2","name2")]
Name1 and Name2 would be filled in automatically, but name1 and name2 would be editable by the user.
If the Parameter Attribute is added once,, the ParamValue Attribute should be generated only once, and if the class would have 10 of them, i would like to generate 10 ParamValue Attributes.

I know this could be achieved with the CodeClass interface(addAttribute), but then it is impossible to use the tab key to jump from one editable element to the next, like you can with the code snippets(snippet literals).

Is it possible to edit a Snippet at runtime/call the Snippet function myself with a in-memory snippet?
Is there any other possibility to achieve a CodeSnippet like workflow(use the tab key to jump from one editable element to another)?

thanks in advance


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>