Одна из проблем, которые Вы имеете с переключателем, использует строки, как "Bob", это вызовет намного больше циклов и строк в скомпилированном коде. IL, который сгенерирован, должен будет объявить строку, установить ее на "Bob", тогда используют его в сравнении. Таким образом с этим в памяти Ваши операторы IF будут работать быстрее.
пз. Привычка вечности в качестве примера работает, потому что Вы не можете включить Типы. (Не я не знаю, почему точно, но мы попробовали его, это не работает. Это имеет отношение к типу, являющемуся переменным)
, Если Вы хотите протестировать это, просто создать отдельное приложение и создать два простых метода, которые делают то, что описано выше, и используйте что-то как Ildasm.exe для наблюдения IL. Вы заметите намного меньше строк в IL Метода оператора IF.
Ildasm идет с VisualStudio...
страница ILDASM - http://msdn.microsoft.com/en-us/library/f7dy01k1 (По сравнению с 80) Учебным руководством по .aspx
ILDASM - http://msdn.microsoft.com/en-us/library/aa309387 (По сравнению с 71) .aspx
A way to achieve this with the current svg recommendation is not known to me.
But there is a working draft for a svg 2.0 module, see: SVG Referenced Parameter Variables. The example with the flowers there is exactly what you are looking for I suppose! But then you probably have to wait until june 2010 or even longer until this is a W3C recommendation and supported by clients I assume.
For now you could probably solve it with scripting.
Я искал ответ на свой вопрос о SVG. Ваш вопрос помог мне решить мой, поэтому я отвечаю на ваш.
.... Прочитайте свой вопрос внимательнее. Включил ДВА примера кода
Образец №1. Коробки с текстом
Образец #2. Стрелки с текстом
Образец 1
<html>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="600" height="900">
<defs>
<g id="my_box"
desc="my rectangle template">
<rect width="80" height="30" x="0" y="-20" style="stroke: black; stroke-opacity: 1; stroke-width: 1; fill: #9dc2de" />
</g>
</defs>
<g transform="translate(50 40)">
<text text-anchor="middle" x="40"> This little box went to market </text>
<use xlink:href="#my_box" />
</g>
<g transform="translate(150 140)">
<use xlink:href="#my_box" />
<text text-anchor="middle" x="40"> This little box stayed home </text>
</g>
<g transform="translate(250 240)">
<use xlink:href="#my_box" />
<text text-anchor="middle" x="40"> This little box had roast beef </text>
</g>
</svg>
</html>
Обратите внимание в примере 1 на то, что порядок расположения ячеек и текста важен.
Sample 2
<html>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="600" height="900">
<defs>
<g id="arrow"
desc="arrow with a long dashed tail">
<marker style="overflow:visible;fill:inherit;stroke:inherit"
id="Arrow1Mend" refX="0.0" refY="0.0" orient="auto">
<path transform="scale(0.4) rotate(180) translate(20,0)"
style="fill-rule:evenodd;stroke-width:2.0pt;marker-start:none;"
d="M 0.0,-15.0 L -20.5,0.0 L 0.0,15.0 "
desc="The actual commands to draw the arrow head"
/>
</marker>
<line transform="translate(0 -450)"
marker-end="url(#Arrow1Mend)"
x1="40" y1="10" x2="40" y2="410"
style="stroke: black; stroke-dasharray: 5, 5; stroke-width: 1; "
desc="This is the tail of the 'arrow'"
/>
</g>
</defs>
<g transform="translate(100 450)">
<text> Text BEFORE xlink </text>
<use xlink:href="#arrow" />
</g>
<g transform="translate(200 550)">
<use xlink:href="#arrow" />
<text> More to say </text>
</g>
<g transform="translate(300 650)">
<use xlink:href="#arrow" />
<text> The last word </text>
</g>
<g transform="translate(400 750)">
<use xlink:href="#arrow" />
<text> Text AFTER xlink </text>
</g>
</svg>
</html>