本文整理汇总了C#中System.Function.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Function.Contains方法的具体用法?C# Function.Contains怎么用?C# Function.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Function
的用法示例。
在下文中一共展示了Function.Contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFunction
public CodeWriter GetFunction( Function function, IList<TypeMap> typeMapList, IList<CSTypeMap> csTypeMapList, IList<EnumData> enumDatas )
{
var writer = new CodeWriter();
if ((function.Version == null || (function.Version.MajorVersion <= 1 && function.Version.MinorVersion <= 1)) && !function.Contains( "extension" ))
return writer;
writer.Indent = 0;
writer.Append( "_" );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( " = GetProcAdress< " );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( "Delegate >( \"gl" );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( "\" );" );
return writer;
}
示例2: GenerateFunction
public CodeWriter GenerateFunction( Function function, IList<TypeMap> typeMapList, IList<CSTypeMap> csTypeMapList, IList<EnumData> enumDatas )
{
if ((function.Version == null || (function.Version.MajorVersion <= 1 && function.Version.MinorVersion <= 1)) && !function.Contains( "extension" ))
return GenerateOpenGLFunction( function, typeMapList, csTypeMapList, enumDatas );
return GenerateDelegateFunction( function, typeMapList, csTypeMapList, enumDatas );
}
示例3: GenerateOpenGLFunction
public CodeWriter GenerateOpenGLFunction( Function function, IList<TypeMap> typeMapList, IList<CSTypeMap> csTypeMapList, IList<EnumData> enumDatas )
{
var writer = new CodeWriter();
writer.Indent = 0;
writer.Append( "[DllImport( \"opengl32.dll\", EntryPoint=\"gl" );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.AppendLine( "\" )]" );
writer.Append( "public static extern " );
if (function.IsUnsafeMethod(typeMapList, csTypeMapList)){
writer.Indent = 0;
writer.Append( "unsafe " );
}
writer.AppendText( function.Return.GetCSName( typeMapList, csTypeMapList, enumDatas ) );
writer.Indent = 0;
writer.Append( " " );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( "( " );
{
var list = new List<CodeWriter>();
CodeWriter temp;
foreach (var item in function.ParamList)
{
temp = this.Invoke( "GenerateParam", item, typeMapList, csTypeMapList, enumDatas );
list.Add( temp );
}
writer.AppendType = AppendType.EmptyLastLine;
for (var listI = 0; listI < list.Count; listI++)
{
var codeWriter = list[listI];
writer.Append( codeWriter );
if (listI < list.Count - 1)
writer.AppendText( ", " );
}
writer.AppendType = AppendType.EmptyLastLine;
}
writer.Indent = 0;
writer.Append( " ); // " );
if (function.Contains( "extension" )){
writer.Indent = 0;
writer.Append( " extension method" );
}
writer.Indent = 0;
writer.AppendLine();
writer.Indent = 1;
return writer;
}
示例4: GenerateDelegateFunction
public CodeWriter GenerateDelegateFunction( Function function, IList<TypeMap> typeMapList, IList<CSTypeMap> csTypeMapList, IList<EnumData> enumDatas )
{
var writer = new CodeWriter();
writer.Indent = 0;
writer.Append( "public " );
if (function.IsUnsafeMethod(typeMapList, csTypeMapList)){
writer.Indent = 0;
writer.Append( "unsafe " );
}
writer.Indent = 0;
writer.Append( "delegate " );
writer.AppendText( function.Return.GetCSName( typeMapList, csTypeMapList, enumDatas ) );
writer.Indent = 0;
writer.Append( " " );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( "Delegate( " );
{
var list = new List<CodeWriter>();
CodeWriter temp;
foreach (var item in function.ParamList)
{
temp = this.Invoke( "GenerateParam", item, typeMapList, csTypeMapList, enumDatas );
list.Add( temp );
}
writer.AppendType = AppendType.EmptyLastLine;
for (var listI = 0; listI < list.Count; listI++)
{
var codeWriter = list[listI];
writer.Append( codeWriter );
if (listI < list.Count - 1)
writer.AppendText( ", " );
}
writer.AppendType = AppendType.EmptyLastLine;
}
writer.Indent = 0;
writer.Append( " ); // " );
if (function.Contains( "extension" )){
writer.Indent = 0;
writer.Append( " extension method" );
}
writer.Indent = 0;
writer.AppendLine();
writer.AppendLine();
writer.Append( "private static " );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( "Delegate _" );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.AppendLine( ";" );
writer.AppendLine();
writer.Append( "public static " );
if (function.IsUnsafeMethod(typeMapList, csTypeMapList)){
writer.Indent = 0;
writer.Append( "unsafe " );
}
writer.Indent = 0;
writer.Append( " " );
writer.AppendText( function.Return.GetCSName( typeMapList, csTypeMapList, enumDatas ) );
writer.Indent = 0;
writer.Append( " " );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( "( " );
{
var list = new List<CodeWriter>();
CodeWriter temp;
foreach (var item in function.ParamList)
{
temp = this.Invoke( "GenerateParam", item, typeMapList, csTypeMapList, enumDatas );
list.Add( temp );
}
writer.AppendType = AppendType.EmptyLastLine;
for (var listI = 0; listI < list.Count; listI++)
{
var codeWriter = list[listI];
writer.Append( codeWriter );
if (listI < list.Count - 1)
writer.AppendText( ", " );
}
writer.AppendType = AppendType.EmptyLastLine;
}
writer.Indent = 0;
writer.AppendLine( " )" );
writer.AppendLine( "{" );
writer.Indent = 1;
writer.Append( "if (_" );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.Append( " == null) throw new Exception( \"Extension method " );
writer.AppendText( function.Name );
writer.Indent = 0;
writer.AppendLine( " not found\" );" );
writer.Indent = 1;
//.........这里部分代码省略.........