ITextTemplatingEngineHost.GetHostOption Method
Called by the Engine to ask for the value of a specified option. Return null if you do not know.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (in Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)
Syntax
'Declaration
Function GetHostOption ( _
optionName As String _
) As Object
Object GetHostOption(
string optionName
)
Object^ GetHostOption(
String^ optionName
)
abstract GetHostOption :
optionName:string -> Object
function GetHostOption(
optionName : String
) : Object
Parameters
optionName
Type: StringThe name of an option.
Return Value
Type: Object
Null to select the default value for this option. Otherwise, an appropriate value for the option.
Remarks
Currently, the only option invoked by the Engine is CacheAssemblies. It returns true if assemblies are retained between successive text template processing runs. The standard hosts return true, unless the string value CacheAssemblies="false" is set in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\version\TextTemplating\.
Examples
The following code example shows a possible implementation for a custom host. This code example is part of a larger example. For the complete example, see Walkthrough: Creating a Custom Text Template Host.
public object GetHostOption(string optionName)
{
object returnObject;
switch (optionName)
{
case "CacheAssemblies":
returnObject = true;
break;
default:
returnObject = null;
break;
}
return returnObject;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
ITextTemplatingEngineHost Interface
Microsoft.VisualStudio.TextTemplating Namespace