1 | <?xml version="1.0" encoding="utf-8" ?>
|
---|
2 | <!-- Overview
|
---|
3 |
|
---|
4 | This file is referenced by ExampleComponent in the conceptual configuration files, which are
|
---|
5 | located in Help\Presentation\Style\Configuration\.
|
---|
6 |
|
---|
7 | You can add additional example snippet files by registering them with ExampleComponent:
|
---|
8 |
|
---|
9 | <examples file="..\..\Help\Settings\additional_snippets.xml"/>
|
---|
10 | -->
|
---|
11 |
|
---|
12 | <!-- About Examples and Snippets
|
---|
13 |
|
---|
14 | Example snippets allow you to define code samples outside of conceptual topic files. An example
|
---|
15 | can be referenced by an ID in multiple topics so that they don't have to be copied or rewritten.
|
---|
16 |
|
---|
17 | Automatic colorization and language filter synchronization is supported by specifying a language
|
---|
18 | identifier on code samples: VisualBasic, CSharp, ManagedCPlusPlus, JSharp, or JScript.
|
---|
19 |
|
---|
20 | You can add custom colorization rules to ExampleComponent and adjust Help\Styles\Presentation.css
|
---|
21 | to apply different styles.
|
---|
22 | -->
|
---|
23 |
|
---|
24 | <!-- Examples
|
---|
25 |
|
---|
26 | To use the following examples, add them to the root <examples> element of this file.
|
---|
27 |
|
---|
28 | <item id="ClassDefinition#1">
|
---|
29 | <sampleCode language="CSharp">
|
---|
30 | public sealed partial class MyClass() {
|
---|
31 | }
|
---|
32 | </sampleCode>
|
---|
33 | <sampleCode language="VisualBasic">
|
---|
34 | Public NotInheritable Partial Class MyClass
|
---|
35 | End Class
|
---|
36 | </sampleCode>
|
---|
37 | </item>
|
---|
38 |
|
---|
39 | <item id="DimVariable#String">
|
---|
40 | <sampleCode language="CSharp">
|
---|
41 | string variable = "Hello, World";
|
---|
42 | </sampleCode>
|
---|
43 | <sampleCode language="VisualBasic">
|
---|
44 | Dim variable As String = "Hello, World"
|
---|
45 | </sampleCode>
|
---|
46 | </item>
|
---|
47 |
|
---|
48 | <item id="DimVariable#Int32">
|
---|
49 | <sampleCode language="CSharp">
|
---|
50 | int variable = 21;
|
---|
51 | </sampleCode>
|
---|
52 | <sampleCode language="VisualBasic">
|
---|
53 | Dim variable As Integer = 21
|
---|
54 | </sampleCode>
|
---|
55 | </item>
|
---|
56 |
|
---|
57 | An item ID is a case-sensitive string that consists of an example ID, a hash (#) and a snippet ID.
|
---|
58 | All parts of the ID are required.
|
---|
59 |
|
---|
60 | The language attribute is a case-sensitive identifier that is defined in the presentation style
|
---|
61 | itself. By default, you can choose from VisualBasic, CSharp, ManagedCPlusPlus, JSharp, or JScript.
|
---|
62 | -->
|
---|
63 |
|
---|
64 | <!-- Example Usage
|
---|
65 |
|
---|
66 | The ClassDefinition example consists of only a single snippet (#1) in multiple languages.
|
---|
67 | Here's how to reference it in a conceptual topic:
|
---|
68 |
|
---|
69 | <codeReference>ClassDefinition#1</codeReference>
|
---|
70 |
|
---|
71 | DimVariable is an example that consists of multiple snippets (String and Int32).
|
---|
72 | Here's how to reference the String snippet:
|
---|
73 |
|
---|
74 | <codeReference>DimVariable#String</codeReference>
|
---|
75 |
|
---|
76 | Here's how to generate a code sample of both DimVariable snippets combined:
|
---|
77 |
|
---|
78 | <codeReference>DimVariable#String,Int32</codeReference>
|
---|
79 |
|
---|
80 | The following reference is invalid because the snippet ID is missing:
|
---|
81 |
|
---|
82 | <codeReference>DimVariable</codeReference> ** invalid **
|
---|
83 | -->
|
---|
84 | <examples>
|
---|
85 | <!-- Add <item> elements that contain language-specific code snippets -->
|
---|
86 | </examples>
|
---|