Posted 18 years ago by Alex
I have two questions regarding code snippets
1. In CodeSnippet constructor what format should have the codeText parameter? I tried to use the snippet XML definition for that, but in this case the snippet actually inserts the entire xml as a block of text. How can I format the codeText to make it working as if it was loaded from the file?

2. There is a method LoadFromXML(string path). In my case I have snippet definitions embedded as string resources. Is there any way to load the snippets directly from a string? Of course I can save it into a temp file first, but it looks like artificial step.


Comments (2)

Posted 18 years ago by Alex
I just noticed the LoadFromXml(XmlDocument doc) overloaded method which answers the second question
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Yes to load from memory, you should use the LoadFromXml overload that accepts an XmlDocument.

The regular constructor of CodeSnippet accepts the actual code snippet "code" part. You have to set the other various properties yourself if using it. So based on what it sounds like you want, you should use the LoadFromXml overload instead.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.