本文整理汇总了C#中Collections.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# Collections.ContainsKey方法的具体用法?C# Collections.ContainsKey怎么用?C# Collections.ContainsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collections
的用法示例。
在下文中一共展示了Collections.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _create
protected override Resource _create( string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, Collections.NameValuePairList createParams )
{
string paramSyntax = string.Empty;
string paramType = string.Empty;
if ( createParams == null || createParams.ContainsKey( "syntax" ) == false || createParams.ContainsKey( "type" ) == false )
{
throw new AxiomException( "You must supply 'syntax' and 'type' parameters" );
}
else
{
paramSyntax = createParams[ "syntax" ];
paramType = createParams[ "type" ];
}
CreateGpuProgramDelegate iter = null;
if ( this._programMap.ContainsKey( paramSyntax ) )
{
iter = this._programMap[ paramSyntax ];
}
else
{
// No factory, this is an unsupported syntax code, probably for another rendersystem
// Create a basic one, it doesn't matter what it is since it won't be used
return new GLES2GpuProgram( this, name, handle, group, isManual, loader );
}
GpuProgramType gpt;
if ( paramType == "vertex_program" )
{
gpt = GpuProgramType.Vertex;
}
else
{
gpt = GpuProgramType.Fragment;
}
return iter( this, name, handle, group, isManual, loader, gpt, paramSyntax );
}
示例2: _create
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <param name="handle"></param>
/// <param name="group"></param>
/// <param name="isManual"></param>
/// <param name="loader"></param>
/// <param name="createParams"></param>
/// <returns></returns>
protected override Resource _create( string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, Collections.NameValuePairList createParams )
{
if ( createParams == null || !createParams.ContainsKey( "syntax" )
|| !createParams.ContainsKey( "type" ) )
{
throw new NotImplementedException( "You must supply 'syntax' and 'type' parameters" );
}
GpuProgramType gpt = 0;
CreateGpuProgramDelegate iter = _programMap[ createParams[ "syntax" ] ];
if ( iter == null )
{
return null;
}
string syntaxcode = string.Empty;
foreach ( KeyValuePair<string, CreateGpuProgramDelegate> pair in _programMap )
if ( pair.Value == iter )
{
syntaxcode = pair.Key;
break;
}
if ( createParams[ "type" ] == "vertex_program" )
{
gpt = GpuProgramType.Vertex;
}
else if ( createParams[ "type" ] == "fragment_program" )
{
gpt = GpuProgramType.Fragment;
}
else
{
throw new AxiomException( "Unknown GpuProgramType : " + createParams[ "type" ] );
}
return iter( this, name, handle, group, isManual, loader, gpt, syntaxcode );
}