## ShaderParamDefContainer.GetParamDefByName

### Introduced

v9.0 (2011)

### Description

Returns the ShaderParamDef that matches the specified name from this container. This is preferable to calling ShaderParamDefContainer.Definitions(in_ParameterName) if you don't need to iterate over the whole ShaderParamDefCollection.
Note: This method could return an invalid object in python, use ShaderParamDefContainer.GetParamDefByName2 instead.

### C# Syntax

    ShaderParamDef ShaderParamDefContainer.GetParamDefByName( String in_ParameterName );

### Scripting Syntax

    oReturn = ShaderParamDefContainer.GetParamDefByName( in_ParameterName );

### Return Value

ShaderParamDef

### Parameters

Parameter | Type | Description
--- | --- | ---
in_ParameterName | String | The registered name of the shader parameter definition to return.

### Examples

#### JScript Example

    /*
            This example demonstrates how to get a specific shader parameter
            definition implemented on a shader definition by name
    */
    var app = Application;
    var oShaderDef = XSIFactory.CreateShaderDef("chucky", "cheez", 1, 0);
    oShaderDef.AddShaderFamily(siShaderFamilyType);
    app.LogMessage("Shader definition name: "+oShaderDef.Name);
    // Set up shader parameter definition options to use with new input
    // parameters: all the settings will be the same except for the name
    // so we will just change that on the ShaderParamDefOptions each time
    var oShaderInParamDefOptions = XSIFactory.CreateShaderParamDefOptions();
    oShaderInParamDefOptions.SetAnimatable(true);
    oShaderInParamDefOptions.SetTexturable(true);
    oShaderInParamDefOptions.SetInspectable(true);
    oShaderInParamDefOptions.SetShortName("Out");
    // Add output parameter to the definition
    var oOutputParams = oShaderDef.OutputParamDefs;
    oOutputParams.AddParamDef("out", siShaderDataTypeColor4, oShaderInParamDefOptions);
    // Add another parameter to the definition
    oShaderInParamDefOptions.SetShortName("Name");
    oOutputParams.AddParamDef("name", siShaderDataTypeString, oShaderInParamDefOptions);
    // Add one more parameter to the definition
    oShaderInParamDefOptions.SetShortName("Valid");
    oOutputParams.AddParamDef("valid", siShaderDataTypeBoolean, oShaderInParamDefOptions);
    // How many input parameters are there?
    app.LogMessage("There are "+oShaderDef.OutputParamDefs.Definitions.Count+" parameter(s) defined here");
    // Get them by name
    var oParamDef3 = oShaderDef.OutputParamDefs.GetParamDefByName("valid");
    var oParamDef1 = oShaderDef.OutputParamDefs.GetParamDefByName("out");
    var oParamDef2 = oShaderDef.OutputParamDefs.GetParamDefByName("name");
    app.LogMessage("Here are the names as they will appear in the UI:");
    app.LogMessage("\t- "+oParamDef1.DisplayName);
    app.LogMessage("\t- "+oParamDef2.DisplayName);
    app.LogMessage("\t- "+oParamDef3.DisplayName);
    // Expected results:
    // INFO : Shader definition name: chucky.cheez.1.0
    // INFO : There are 3 parameter(s) defined here
    // INFO : Here are the names as they will appear in the UI:
    // INFO :       - Out
    // INFO :       - Name
    // INFO :       - Valid

### See Also

ShaderParamDefContainer.Definitions