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


C# GetMemberOptions类代码示例

本文整理汇总了C#中GetMemberOptions的典型用法代码示例。如果您正苦于以下问题:C# GetMemberOptions类的具体用法?C# GetMemberOptions怎么用?C# GetMemberOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetNestedTypesImpl

		static IEnumerable<IType> GetNestedTypesImpl(IType outerType, IList<IType> nestedTypeArguments, Predicate<ITypeDefinition> filter, GetMemberOptions options)
		{
			ITypeDefinition outerTypeDef = outerType.GetDefinition();
			if (outerTypeDef == null)
				yield break;
			
			int outerTypeParameterCount = outerTypeDef.TypeParameterCount;
			ParameterizedType pt = outerType as ParameterizedType;
			foreach (ITypeDefinition nestedType in outerTypeDef.NestedTypes) {
				int totalTypeParameterCount = nestedType.TypeParameterCount;
				if (nestedTypeArguments != null) {
					if (totalTypeParameterCount - outerTypeParameterCount != nestedTypeArguments.Count)
						continue;
				}
				if (!(filter == null || filter(nestedType)))
					continue;
				
				if (totalTypeParameterCount == 0 || (options & GetMemberOptions.ReturnMemberDefinitions) == GetMemberOptions.ReturnMemberDefinitions) {
					yield return nestedType;
				} else {
					// We need to parameterize the nested type
					IType[] newTypeArguments = new IType[totalTypeParameterCount];
					for (int i = 0; i < outerTypeParameterCount; i++) {
						newTypeArguments[i] = pt != null ? pt.GetTypeArgument(i) : outerTypeDef.TypeParameters[i];
					}
					for (int i = outerTypeParameterCount; i < totalTypeParameterCount; i++) {
						if (nestedTypeArguments != null)
							newTypeArguments[i] = nestedTypeArguments[i - outerTypeParameterCount];
						else
							newTypeArguments[i] = SpecialType.UnboundTypeArgument;
					}
					yield return new ParameterizedType(nestedType, newTypeArguments);
				}
			}
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:35,代码来源:GetMembersHelper.cs

示例2: NormalCompletionAnalysis

 public NormalCompletionAnalysis(VsProjectAnalyzer vsProjectAnalyzer, ITextSnapshot snapshot, VisualStudio.Text.ITrackingSpan applicableSpan, VisualStudio.Text.ITextBuffer textBuffer, GetMemberOptions options)
     : base(applicableSpan, textBuffer) {
     _analyzer = vsProjectAnalyzer;
     _snapshot = snapshot;
     _applicableSpan = applicableSpan;
     _textBuffer = textBuffer;
     _options = options;
 }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:8,代码来源:NormalCompletionAnalysis.cs

示例3: GetNestedTypes

		public static IEnumerable<IType> GetNestedTypes(IType type, IList<IType> nestedTypeArguments, Predicate<ITypeDefinition> filter, GetMemberOptions options)
		{
			if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers) {
				return GetNestedTypesImpl(type, nestedTypeArguments, filter, options);
			} else {
				return type.GetNonInterfaceBaseTypes().SelectMany(t => GetNestedTypesImpl(t, nestedTypeArguments, filter, options));
			}
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:8,代码来源:GetMembersHelper.cs

示例4: GetAllMembers

 public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) {
     var res = new Dictionary<string, IAnalysisSet>();
     foreach (var kvp in _scope.AllVariables) {
         kvp.Value.ClearOldValues();
         if (kvp.Value._dependencies.Count > 0) {
             var types = kvp.Value.Types;
             if (types.Count > 0) {
                 res[kvp.Key] = types;
             }
         }
     }
     return res;
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:ModuleInfo.cs

示例5: GetAllMembers

        public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None)
        {
            var mro = ClassInfo._mro;
            if (!mro.IsValid) {
                return new Dictionary<string, IAnalysisSet>();
            }

            if (options.HasFlag(GetMemberOptions.DeclaredOnly)) {
                return Values.Mro.GetAllMembersOfMro(mro.Skip(1).Take(1), moduleContext, options);
            }

            // First item in MRO list is always the class itself.
            return Values.Mro.GetAllMembersOfMro(mro.Skip(1), moduleContext, options);
        }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例6: GetAllMembers

        public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) {
            var res = new Dictionary<string, IAnalysisSet>();
            if (_instanceAttrs != null) {
                foreach (var kvp in _instanceAttrs) {
                    var types = kvp.Value.TypesNoCopy;
                    var key = kvp.Key;
                    kvp.Value.ClearOldValues();
                    if (kvp.Value.VariableStillExists) {
                        MergeTypes(res, key, types);
                    }
                }
            }

            // check and see if it's defined in a base class instance as well...
            if (!options.HasFlag(GetMemberOptions.DeclaredOnly)) {
                foreach (var b in _classInfo.Bases) {
                    foreach (var ns in b) {
                        if (ns.Push()) {
                            try {
                                ClassInfo baseClass = ns as ClassInfo;
                                if (baseClass != null &&
                                    baseClass.Instance._instanceAttrs != null) {
                                    foreach (var kvp in baseClass.Instance._instanceAttrs) {
                                        kvp.Value.ClearOldValues();
                                        if (kvp.Value.VariableStillExists) {
                                            MergeTypes(res, kvp.Key, kvp.Value.TypesNoCopy);
                                        }
                                    }
                                }
                            } finally {
                                ns.Pop();
                            }
                        }
                    }
                }

                foreach (var classMem in _classInfo.GetAllMembers(moduleContext)) {
                    MergeTypes(res, classMem.Key, classMem.Value);
                }
            }
            return res;
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:42,代码来源:InstanceInfo.cs

示例7: GetNestedTypesImpl

		static IEnumerable<IType> GetNestedTypesImpl(IType outerType, IList<IType> nestedTypeArguments, ITypeResolveContext context, Predicate<ITypeDefinition> filter, GetMemberOptions options)
		{
			ITypeDefinition outerTypeDef = outerType.GetDefinition();
			if (outerTypeDef == null)
				yield break;
			
			int outerTypeParameterCount = outerTypeDef.TypeParameterCount;
			ParameterizedType pt = outerType as ParameterizedType;
			foreach (ITypeDefinition nestedType in outerTypeDef.NestedTypes) {
				int totalTypeParameterCount = nestedType.TypeParameterCount;
				if (nestedTypeArguments != null) {
					if (totalTypeParameterCount - outerTypeParameterCount != nestedTypeArguments.Count)
						continue;
				}
				if (!(filter == null || filter(nestedType)))
					continue;
				
				if ((options & GetMemberOptions.ReturnMemberDefinitions) == GetMemberOptions.ReturnMemberDefinitions) {
					yield return nestedType;
				} else if (totalTypeParameterCount == 0 || (pt == null && totalTypeParameterCount == outerTypeParameterCount)) {
					// The nested type has no new type parameters, and there are no type arguments
					// to copy from the outer type
					// -> we can directly return the nested type definition
					yield return nestedType;
				} else {
					// We need to parameterize the nested type
					IType[] newTypeArguments = new IType[totalTypeParameterCount];
					for (int i = 0; i < outerTypeParameterCount; i++) {
						newTypeArguments[i] = pt != null ? pt.GetTypeArgument(i) : outerTypeDef.TypeParameters[i];
					}
					for (int i = outerTypeParameterCount; i < totalTypeParameterCount; i++) {
						if (nestedTypeArguments != null)
							newTypeArguments[i] = nestedTypeArguments[i - outerTypeParameterCount];
						else
							newTypeArguments[i] = SharedTypes.UnboundTypeArgument;
					}
					yield return new ParameterizedType(nestedType, newTypeArguments);
				}
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:40,代码来源:GetMembersHelper.cs

示例8: GetAccessors

		public override IEnumerable<IMethod> GetAccessors(Predicate<IUnresolvedMethod> filter, GetMemberOptions options)
		{
			for (int i = 0; i < unresolvedProperties.Length; i++) {
				if (unresolvedProperties[i].CanGet) {
					if (filter == null || filter(unresolvedProperties[i].Getter))
						yield return resolvedProperties[i].Getter;
				}
				if (unresolvedProperties[i].CanSet) {
					if (filter == null || filter(unresolvedProperties[i].Setter))
						yield return resolvedProperties[i].Setter;
				}
			}
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:13,代码来源:AnonymousType.cs

示例9: FallbackWorker

        internal static DynamicMetaObject FallbackWorker(DynamicMetaObject/*!*/ self, Expression/*!*/ codeContext, string name, GetMemberOptions options, DynamicMetaObjectBinder action) {
            if (self.NeedsDeferral()) {
                return action.Defer(self);
            }

            bool isNoThrow = ((options & GetMemberOptions.IsNoThrow) != 0) ? true : false;
            Type limitType = self.GetLimitType() ;

            if (limitType == typeof(DynamicNull) || PythonBinder.IsPythonType(limitType)) {
                // look up in the PythonType so that we can 
                // get our custom method names (e.g. string.startswith)            
                PythonType argType = DynamicHelpers.GetPythonTypeFromType(limitType);

                // if the name is defined in the CLS context but not the normal context then
                // we will hide it.                
                if (argType.IsHiddenMember(name)) {
                    DynamicMetaObject baseRes = BinderState.GetBinderState(action).Binder.GetMember(
                        name,
                        self,
                        codeContext,
                        isNoThrow
                    );
                    Expression failure = GetFailureExpression(limitType, name, isNoThrow, action);

                    return BindingHelpers.FilterShowCls(codeContext, action, baseRes, failure);
                }
            }

            if (self.GetLimitType() == typeof(OldInstance)) {
                if ((options & GetMemberOptions.IsNoThrow) != 0) {
                    return new DynamicMetaObject(
                        Ast.Field(
                            null,
                            typeof(OperationFailed).GetField("Value")
                        ),
                        self.Restrictions.Merge(BindingRestrictionsHelpers.GetRuntimeTypeRestriction(self.Expression, typeof(OldInstance)))
                    );
                } else {
                    return new DynamicMetaObject(
                        Ast.Throw(
                            Ast.Call(
                                typeof(PythonOps).GetMethod("AttributeError"),
                                Ast.Constant("{0} instance has no attribute '{1}'"),
                                Ast.NewArrayInit(
                                    typeof(object),
                                    Ast.Constant(((OldInstance)self.Value)._class._name),
                                    Ast.Constant(name)
                                )
                            )
                        ),
                        self.Restrictions.Merge(BindingRestrictionsHelpers.GetRuntimeTypeRestriction(self.Expression, typeof(OldInstance)))
                    );
                }
            }

            var res = BinderState.GetBinderState(action).Binder.GetMember(name, self, codeContext, isNoThrow);

            // Default binder can return something typed to boolean or int.
            // If that happens, we need to apply Python's boxing rules.
            if (res.Expression.Type == typeof(bool) || res.Expression.Type == typeof(int)) {
                res = new DynamicMetaObject(
                    AstUtils.Convert(res.Expression, typeof(object)),
                    res.Restrictions
                );
            }

            return res;
        }
开发者ID:octavioh,项目名称:ironruby,代码行数:68,代码来源:PythonGetMemberBinder.cs

示例10: GetAccessors

		public IEnumerable<IMethod> GetAccessors(Predicate<IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)
		{
			if ((options & GetMemberOptions.ReturnMemberDefinitions) == GetMemberOptions.ReturnMemberDefinitions)
				return genericType.GetAccessors(filter, options);
			else
				return GetMembersHelper.GetAccessors(this, filter, options);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:7,代码来源:ParameterizedType.cs

示例11: GetMethods

		public IEnumerable<IMethod> GetMethods(IList<IType> typeArguments, Predicate<IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)
		{
			if ((options & GetMemberOptions.ReturnMemberDefinitions) == GetMemberOptions.ReturnMemberDefinitions)
				return genericType.GetMethods(typeArguments, filter, options);
			else
				return GetMembersHelper.GetMethods(this, typeArguments, filter, options);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:7,代码来源:ParameterizedType.cs

示例12: GetMembers

		public override IEnumerable<IMember> GetMembers(Predicate<IUnresolvedMember> filter, GetMemberOptions options)
		{
			return EmptyList<IMember>.Instance;
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:4,代码来源:VoidTypeDefinition.cs

示例13: GetMethods

		public override IEnumerable<IMethod> GetMethods(IList<IType> typeArguments, Predicate<IUnresolvedMethod> filter, GetMemberOptions options)
		{
			return EmptyList<IMethod>.Instance;
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:4,代码来源:VoidTypeDefinition.cs

示例14: SingleMemberResult

 private static IEnumerable<MemberResult> SingleMemberResult(string privatePrefix, GetMemberOptions options, IDictionary<string, IAnalysisSet> memberDict)
 {
     foreach (var kvp in memberDict) {
         string name = GetMemberName(privatePrefix, options, kvp.Key);
         if (name != null) {
             yield return new MemberResult(name, kvp.Value);
         }
     }
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例15: ToCompletions

        private AP.Completion[] ToCompletions(MemberResult[] memberResult, GetMemberOptions options) {
            AP.Completion[] res = new AP.Completion[memberResult.Length];
            for (int i = 0; i < memberResult.Length; i++) {
                var member = memberResult[i];

                res[i] = new AP.Completion() {
                    name = member.Name,
                    completion = member.Completion,
                    doc = member.Documentation,
                    memberType = member.MemberType
                };

                if (options.HasFlag(GetMemberOptions.DetailedInformation)) {
                    List<AP.CompletionValue> values = new List<AnalysisProtocol.CompletionValue>();

                    foreach (var value in member.Values) {
                        var descComps = Array.Empty<AP.DescriptionComponent>();
                        var hasDesc = value as IHasRichDescription;
                        if (hasDesc != null) {
                            descComps = hasDesc
                                .GetRichDescription()
                                .Select(kv => new AP.DescriptionComponent(kv.Value, kv.Key))
                                .ToArray();
                        }
                        values.Add(
                            new AP.CompletionValue() {
                                description = descComps,
                                doc = value.Documentation,
                                locations = value.Locations.Select(x => MakeReference(x, VariableType.Definition)).ToArray()
                            }
                        );
                    }
                    res[i].detailedValues = values.ToArray();
                }
            }
            return res;
        }
开发者ID:,项目名称:,代码行数:37,代码来源:


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