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


C# ReadOnlyArray.Any方法代码示例

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


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

示例1: AssemblyResolver

        public AssemblyResolver(
            ReadOnlyArray<string> searchPaths,
            Func<string, string> getFullPath,
            Func<ProcessorArchitecture, bool> architectureFilter,
            CultureInfo preferredCulture)
        {
            Contract.ThrowIfTrue(searchPaths.IsNull);
            Contract.ThrowIfTrue(searchPaths.Any(p => string.IsNullOrEmpty(p)));

            this.searchPaths = searchPaths;
            this.getFullPath = getFullPath ?? FileUtilities.TryGetFullPath;
            this.architectureFilter = architectureFilter;
            this.preferredCulture = preferredCulture;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:14,代码来源:AssemblyResolver.cs

示例2: SemanticInfo

        internal SemanticInfo(
            TypeSymbol type,
            Conversion conversion,
            TypeSymbol convertedType,
            ReadOnlyArray<Symbol> symbols,
            LookupResultKind resultKind,
            ReadOnlyArray<MethodSymbol> methodGroup,
            ConstantValue constantValue)
        {
            // When constructing the result for the Caas API, we expose the underlying symbols that
            // may have been hidden under error type, if the error type was immediate. We will
            // expose error types that were constructed, or type parameters of constructed types.
            this.Type = type.GetNonErrorGuess() ?? type;
            this.ConvertedType = convertedType.GetNonErrorGuess() ?? convertedType;
            this.ImplicitConversion = conversion;

            this.symbols = symbols;
            this.resultKind = resultKind;
            if (!symbols.Any())
            {
                this.resultKind = LookupResultKind.Empty;
            }

            this.MethodGroup = methodGroup;
            this.constantValue = constantValue;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:26,代码来源:SemanticInfo.cs

示例3: EmitMethodArgumentsAndGenerics

        private BoundValueType EmitMethodArgumentsAndGenerics(MethodInfo method, ReadOnlyArray<BoundCallArgument> arguments, ReadOnlyArray<BoundExpression> generics)
        {
            bool needWriteBack = arguments.Any(p => p.IsRef && p.Expression.IsAssignable());

            // Load the arguments array.

            LocalBuilder arrayLocal = null;

            if (arguments.Count > 0 || generics.Count > 0)
            {
                int count = arguments.Count;
                if (generics.Count > 0)
                    count++;

                // Create the array to hold the arguments.
                IL.EmitConstant(count);
                IL.Emit(OpCodes.Newarr, typeof(object));

                // Emit store for the elements.
                EmitArrayElementsStore(arguments.Select(p => p.Expression));

                // We smuggle the generic arguments into the last entry of the
                // arguments array. If we have generic arguments, create a
                // JsGenericArguments object to hold them and put it at the end
                // of the array.

                if (generics.Count > 0)
                {
                    // Dup the array reference for the Stelem. We're going to leave
                    // the array reference on the stack.
                    IL.Emit(OpCodes.Dup);
                    // Emit the index the item is at.
                    IL.EmitConstant(count - 1);

                    // Emit the array to hold the generic arguments.
                    IL.EmitConstant(generics.Count);
                    IL.Emit(OpCodes.Newarr, typeof(object));
                    // Store the generic arguments.
                    EmitArrayElementsStore(generics);
                    // Emit the JsGenericArguments object.
                    IL.Emit(OpCodes.Newobj, _genericArgumentsConstructor);

                    // Store the generic arguments in the array.
                    IL.Emit(OpCodes.Stelem_Ref);
                }

                // If we're doing a write back, we need to hold on to a reference
                // to the array, so dup the stack element here and store it in
                // a local.

                if (needWriteBack)
                {
                    arrayLocal = IL.DeclareLocal(typeof(object[]));
                    IL.Emit(OpCodes.Dup);
                    IL.Emit(OpCodes.Stloc, arrayLocal);
                }
            }
            else
            {
                IL.Emit(OpCodes.Ldsfld, _emptyObjectArray);
            }

            // And execute the method.

            IL.EmitCall(method);

            // The result is now on the stack, which we leave there as the result
            // of this emit.

            if (needWriteBack)
            {
                // We need to read the arguments back for when the ExecuteFunction
                // has out parameters for native calls.

                for (int i = 0; i < arguments.Count; i++)
                {
                    var argument = arguments[i];

                    if (!argument.IsRef || !argument.Expression.IsAssignable())
                        continue;

                    var valueExpression = new BoundEmitExpression(
                        BoundValueType.Unknown,
                        () =>
                        {
                            // Load the argument from the array.
                            IL.Emit(OpCodes.Ldloc, arrayLocal);
                            IL.EmitConstant(i);
                            IL.Emit(OpCodes.Ldelem_Ref);
                        }
                    );

                    if (argument.Expression.Kind == BoundKind.GetMember)
                    {
                        var getMember = (BoundGetMember)argument.Expression;

                        EmitSetMember(getMember.Expression, getMember.Index, valueExpression);
                    }
                    else
                    {
//.........这里部分代码省略.........
开发者ID:pvginkel,项目名称:Jint2,代码行数:101,代码来源:CodeGenerator.cs


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