当前位置: 首页>>代码示例>>C#>>正文


C# IEntity.OfType方法代码示例

本文整理汇总了C#中IEntity.OfType方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.OfType方法的具体用法?C# IEntity.OfType怎么用?C# IEntity.OfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntity的用法示例。


在下文中一共展示了IEntity.OfType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPropertyAccessors

 private static IEntity[] GetPropertyAccessors(IEntity[] entities, Func<IProperty, IEntity> selector)
 {
     return entities.OfType<IProperty>().Select(selector).Distinct().ToArray();
 }
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs

示例2: EmitCallableResolutionError

        private void EmitCallableResolutionError(Node sourceNode, IEntity[] candidates, ExpressionCollection args)
        {
            //if this is call without arguments and ambiguous contains generic method without arguments
            //than emit BCE0164 for readability
            var genericMethod = candidates.OfType<IMethod>().FirstOrDefault(m => m.GenericInfo != null && m.GetParameters().Length == 0);
            if (args.Count == 0 && genericMethod != null)
            {
                Error(CompilerErrorFactory.CannotInferGenericMethodArguments(sourceNode, genericMethod));
                return;
            }

            if (CallableResolutionService.ValidCandidates.Count > 1)
            {
                Error(CompilerErrorFactory.AmbiguousReference(sourceNode, candidates[0].Name, CallableResolutionService.ValidCandidates.Select(c => (IEntity)c.Method)));
                return;
            }

            var candidate = candidates[0];
            var constructor = candidate as IConstructor;
            if (constructor != null)
            {
                Error(CompilerErrorFactory.NoApropriateConstructorFound(sourceNode, constructor.DeclaringType, GetSignature(args)));
            }
            else
            {
                Error(CompilerErrorFactory.NoApropriateOverloadFound(sourceNode, GetSignature(args), candidate.FullName));
            }
        }
开发者ID:stuman08,项目名称:boo,代码行数:28,代码来源:ProcessMethodBodies.cs

示例3: RenderPass

        private void RenderPass(IGameContext gameContext, IRenderContext renderContext, IRenderPass renderPass, IEntity[] entities)
        {
            if (!renderPass.SkipWorldRenderBelow)
            {
                gameContext.World.RenderBelow(gameContext, renderContext);
            }

            if (!renderPass.SkipEntityRender)
            {
                foreach (var entity in entities.OfType<IPrerenderableEntity>())
                {
                    entity.Prerender(gameContext, renderContext);
                }

                foreach (var entity in entities)
                {
                    entity.Render(gameContext, renderContext);
                }
            }

            if (!renderPass.SkipWorldRenderAbove)
            {
                gameContext.World.RenderAbove(gameContext, renderContext);
            }

            if (!renderPass.SkipEngineHookRender)
            {
                foreach (var hook in _engineHooks)
                {
                    hook.Render(gameContext, renderContext);
                }
            }
        }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:33,代码来源:DefaultRenderPipeline.cs


注:本文中的IEntity.OfType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。