• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MemberFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: EnumChildren

        public static void EnumChildren(ICompletionDataGenerator cdgen,ResolutionContext ctxt, UserDefinedType udt, bool isVarInstance, 
			MemberFilter vis = MemberFilter.Methods | MemberFilter.Types | MemberFilter.Variables | MemberFilter.Enums)
        {
            var scan = new MemberCompletionEnumeration(ctxt, cdgen) { isVarInst = isVarInstance };

            scan.DeepScanClass(udt, vis);
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:MemberCompletionEnumeration.cs


示例2: Type

 static Type()
 {
     System.__Filters filters = new System.__Filters();
     FilterAttribute = new MemberFilter(filters.FilterAttribute);
     FilterName = new MemberFilter(filters.FilterName);
     FilterNameIgnoreCase = new MemberFilter(filters.FilterIgnoreCase);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:Type.cs


示例3: CtrlSpaceCompletionProvider

 public CtrlSpaceCompletionProvider(ICompletionDataGenerator cdg, IBlockNode b, IStatement stmt, MemberFilter vis = MemberFilter.All)
     : base(cdg)
 {
     this.curBlock = b;
     this.curStmt = stmt;
     visibleMembers = vis;
 }
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:7,代码来源:CtrlSpaceCompletionProvider.cs


示例4: EnumScopedBlockChildren

		public static List<INode> EnumScopedBlockChildren (ResolutionContext ctxt,MemberFilter VisibleMembers)
		{
			var en = new ItemEnumeration (ctxt);

			en.ScanBlock(ctxt.ScopedBlock, ctxt.ScopedBlock.EndLocation, VisibleMembers);

			return en.Nodes;
		}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:8,代码来源:ItemEnumeration.cs


示例5: EnumChildren

		public static List<INode> EnumChildren(UserDefinedType ds,ResolutionContext ctxt, MemberFilter VisibleMembers)
		{
			var en = new ItemEnumeration(ctxt);

			en.DeepScanClass(ds, new ItemCheckParameters(VisibleMembers));

			return en.Nodes;
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:8,代码来源:ItemEnumeration.cs


示例6: EnumChildren

        public static void EnumChildren(ICompletionDataGenerator cdgen,ResolutionContext ctxt, UserDefinedType udt, 
			MemberFilter vis = MemberFilter.Methods | MemberFilter.Types | MemberFilter.Variables | MemberFilter.Enums)
        {
            vis ^= MemberFilter.TypeParameters;

            var scan = new MemberCompletionEnumeration(ctxt, cdgen) { isVarInst = udt.NonStaticAccess };

            scan.DeepScanClass(udt, vis);
        }
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:9,代码来源:MemberCompletionEnumeration.cs


示例7: SafeInvokeHelper

 static SafeInvokeHelper()
 {
     AssemblyName name = new AssemblyName();
     name.Name = "temp";
     myAsmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
     builder = myAsmBuilder.DefineDynamicModule("TempModule");
     methodLookup = new Hashtable();
     delLookup=new Hashtable();
     methodFilter = new MemberFilter(FiltByMethodName);
     lastCleanTime = DateTime.Now;
 }
开发者ID:baidang201,项目名称:ProductExcel,代码行数:11,代码来源:SafeInvokeHelper.cs


示例8: EnumAllAvailableMembers

        public static IEnumerable<INode> EnumAllAvailableMembers(
			ResolverContextStack ctxt,
			CodeLocation Caret,
			MemberFilter VisibleMembers)
        {
            var en = new ItemEnumeration(ctxt);

            en.IterateThroughScopeLayers(Caret, VisibleMembers);

            return en.Nodes.Count <1 ? null : en.Nodes;
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:11,代码来源:ItemEnumeration.cs


示例9: CanAddMemberOfType

        public static bool CanAddMemberOfType(MemberFilter vis, INode n)
        {
            if (n is DMethod)
                return n.NameHash != 0 && ((vis & MemberFilter.Methods) == MemberFilter.Methods);

            else if (n is DVariable)
            {
                var d = n as DVariable;

                if (d.IsAliasThis)
                    return false;

                // Only add aliases if at least types,methods or variables shall be shown.
                if (d.IsAlias)
                    return
                        vis.HasFlag(MemberFilter.Methods) ||
                        vis.HasFlag(MemberFilter.Types) ||
                        vis.HasFlag(MemberFilter.Variables);

                return (vis & MemberFilter.Variables) == MemberFilter.Variables;
            }

            else if (n is DClassLike)
            {
                var dc = n as DClassLike;
                switch (dc.ClassType)
                {
                    case DTokens.Class:
                        return (vis & MemberFilter.Classes) != 0;
                    case DTokens.Interface:
                        return (vis & MemberFilter.Interfaces) != 0;
                    case DTokens.Template:
                        return (vis & MemberFilter.Templates) != 0;
                    case DTokens.Struct:
                    case DTokens.Union:
                        return (vis & MemberFilter.StructsAndUnions) != 0;
                }
            }

            else if (n is DEnum)
            {
                var d = n as DEnum;

                // Only show enums if a) they're named and enums are allowed or b) variables are allowed
                return d.IsAnonymous ?
                    (vis & MemberFilter.Variables) != 0 :
                    (vis & MemberFilter.Enums) != 0;
            }
            else if (n is NamedTemplateMixinNode)
                return (vis & (MemberFilter.Variables | MemberFilter.Types)) == (MemberFilter.Variables | MemberFilter.Types);

            return false;
        }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:53,代码来源:AbstractVisitor.cs


示例10: EnumAllAvailableMembers

        public static void EnumAllAvailableMembers(ICompletionDataGenerator cdgen, IBlockNode ScopedBlock
			, IStatement ScopedStatement,
			CodeLocation Caret,
		    ParseCacheView CodeCache,
			MemberFilter VisibleMembers,
			ConditionalCompilationFlags compilationEnvironment = null)
        {
            var ctxt = ResolutionContext.Create(CodeCache, compilationEnvironment, ScopedBlock, ScopedStatement);

            var en = new MemberCompletionEnumeration(ctxt, cdgen) {isVarInst = true};

            en.IterateThroughScopeLayers(Caret, VisibleMembers);
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:13,代码来源:MemberCompletionEnumeration.cs


示例11: Main

	public static int Main ()
	{
		I.GetTextFn _ = I.GetText;

	Console.WriteLine ("Value: " + I.GetText);
		X x = new X ();

		Thread thr = new Thread (new ThreadStart (x.Thread_func));

		thr.Start ();
		Console.WriteLine ("Inside main ");
		thr.Join ();

		Console.WriteLine (_("Hello"));

		x.Bar ();

		MemberFilter filter = new MemberFilter (MyFilter);

		Type t = x.GetType ();

		MemberInfo [] mi = t.FindMembers (MemberTypes.Method, BindingFlags.Static | BindingFlags.NonPublic,
						  Type.FilterName, "MyFilter");

		Console.WriteLine ("FindMembers called, mi = " + mi);
		Console.WriteLine ("   Count: " + mi.Length);
		if (!filter (mi [0], "MyFilter"))
			return 1;

		//
		// This test is used to call into a delegate defined in a separate
		// namespace, but which is still not a nested delegate inside a class
		//
		NameSpace.TestDelegate td = new NameSpace.TestDelegate (multiply_by_three);

		if (td (8) != 24)
			return 30;

		//
		// Check the names that were used to define the delegates
		//
		if (td.GetType ().FullName != "NameSpace.TestDelegate")
			return 31;

		if (_.GetType ().FullName != "I+GetTextFn")
			return 32;
		
		Console.WriteLine ("Test passes");

		return 0;
	}
开发者ID:nobled,项目名称:mono,代码行数:51,代码来源:test-19.cs


示例12: IterateThroughScopeLayers

		public virtual void IterateThroughScopeLayers(CodeLocation Caret, MemberFilter VisibleMembers = MemberFilter.All)
		{
			if (ctxt.ScopedStatement != null &&
				ScanStatementHierarchy(ctxt.ScopedStatement, Caret, VisibleMembers))
			{
				if (ctxt.ScopedBlock is DMethod &&
					ScanBlock(ctxt.ScopedBlock, Caret, VisibleMembers))
				{
					// Error: Locals are shadowing parameters!
				}
				
				return;
			}

			if(ctxt.ScopedBlock != null && 
			   ScanBlockUpward(ctxt.ScopedBlock, Caret, VisibleMembers))
				return;
			
			// Handle available modules/packages
			var nameStubs = new List<string>();
			if(ctxt.ParseCache != null)
				foreach(var root in ctxt.ParseCache)
				{
					ModulePackage[] packs;
					var mods = PrefilterSubnodes(root, out packs);
					
					if(packs != null){
						foreach(var pack in packs)
						{
							if(nameStubs.Contains(pack.Name))
								continue;
							
							HandleItem(new PackageSymbol(pack, null));
							nameStubs.Add(pack.Name);
						}
					}
					
					if(mods != null)
					{
						HandleItems(mods);
					}
				}

			// On the root level, handle __ctfe variable
			if (CanAddMemberOfType(VisibleMembers, __ctfe) &&
				HandleItem(__ctfe))
				return;
		}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:48,代码来源:AbstractVisitor.cs


示例13: DataService

 protected DataService() {
     Type type = this.GetType();
     AttributeCollection attrs = TypeDescriptor.GetAttributes(type);
     DataAdapterAttribute attr = (DataAdapterAttribute)attrs[typeof(DataAdapterAttribute)];
     if (attr != null) {
         _adapter = Activator.CreateInstance(attr.DataAdapterType);
     }
     _fillMethods = _fillMethodCache[type] as Hashtable;
     if (_fillMethods == null) {
         if (attr != null) {
             string[] methodNames = attr.GetDataMethodNames;
             _fillMethods = Hashtable.Synchronized(new Hashtable(methodNames.Length));
             foreach (string methodName in methodNames) {
                 MethodInfo method = attr.DataAdapterType.GetMethod(methodName, PublicIgnoreCaseBindingFlags);
                 _fillMethods[methodName] = method;
                 if (_defaultFillMethod == null) {
                     _defaultFillMethod = method;
                 }
             }
             if (!String.IsNullOrEmpty(attr.UpdateMethodName)) {
                 MemberFilter filter = new MemberFilter(FilterMethodWithDataTableParameter);
                 MemberInfo[] updateMethods = attr.DataAdapterType.FindMembers(
                     MemberTypes.Method,
                     PublicIgnoreCaseBindingFlags,
                     filter,
                     attr.UpdateMethodName);
                 if (updateMethods.Length != 0) {
                     _updateMethod = (MethodInfo)updateMethods[0];
                 }
             }
         }
         else {
             _fillMethods = Hashtable.Synchronized(new Hashtable());
         }
         _updateMethodCache[type] = _updateMethod;
         _defaultFillMethodCache[type] = _defaultFillMethod;
         _fillMethodCache[type] = _fillMethods;
     }
     else {
         _updateMethod = _updateMethodCache[type] as MethodInfo;
         _defaultFillMethod = _defaultFillMethodCache[type] as MethodInfo;
     }
 }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:43,代码来源:DataService.cs


示例14: GetMethodGroup

        /// <summary>
        /// Gets a singleton method group from the provided type.
        /// 
        /// The provided method group will be unique based upon the methods defined, not based upon the type/name
        /// combination.  In other words calling GetMethodGroup on a base type and a derived type that introduces
        /// no new methods under a given name will result in the same method group for both types.
        /// </summary>
        public static MethodGroup GetMethodGroup(Type type, string name, BindingFlags bindingFlags, MemberFilter filter) {
            ContractUtils.RequiresNotNull(type, "type");
            ContractUtils.RequiresNotNull(name, "name");

            MemberInfo[] mems = type.FindMembers(MemberTypes.Method,
                bindingFlags,
                filter ?? delegate(MemberInfo mem, object filterCritera) {
                    return mem.Name == name;
                },
                null);

            MethodGroup res = null;
            if (mems.Length != 0) {
                MethodInfo[] methods = ArrayUtils.ConvertAll<MemberInfo, MethodInfo>(
                    mems,
                    delegate(MemberInfo x) { return (MethodInfo)x; }
                );
                res = GetMethodGroup(name, methods);
            }
            return res;
        }
开发者ID:apboyle,项目名称:ironruby,代码行数:28,代码来源:ReflectionCache.cs


示例15: FindMembers

 /// <summary>
 /// Returns a filtered array of <see cref="T:System.Reflection.MemberInfo"/> objects of the specified member type.
 /// </summary>
 /// <returns>
 /// A filtered array of <see cref="T:System.Reflection.MemberInfo"/> objects of the specified member type.
 /// -or- 
 /// An empty array of type <see cref="T:System.Reflection.MemberInfo"/>, if the current <see cref="T:System.Type"/> does not have members of type <paramref name="memberType"/> that match the filter criteria.
 /// </returns>
 /// <param name="memberType">
 /// A MemberTypes object indicating the type of member to search for. 
 /// </param>
 /// <param name="bindingAttr">
 /// A bitmask comprised of one or more <see cref="T:System.Reflection.BindingFlags"/> that specify how the search is conducted.
 /// -or- 
 /// Zero, to return null. 
 /// </param>
 /// <param name="filter">
 /// The delegate that does the comparisons, returning true if the member currently being inspected matches the <paramref name="filterCriteria"/> and false otherwise. You can use the FilterAttribute, FilterName, and FilterNameIgnoreCase delegates supplied by this class. The first uses the fields of FieldAttributes, MethodAttributes, and MethodImplAttributes as search criteria, and the other two delegates use String objects as the search criteria. 
 /// </param>
 /// <param name="filterCriteria">
 /// The search criteria that determines whether a member is returned in the array of MemberInfo objects.
 /// The fields of FieldAttributes, MethodAttributes, and MethodImplAttributes can be used in conjunction with the FilterAttribute delegate supplied by this class. 
 /// </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="filter"/> is null. 
 /// </exception>
 /// <filterpriority>2</filterpriority>
 public MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria)
 {
     return _type.FindMembers(memberType, bindingAttr, filter, filterCriteria);
 }
开发者ID:pars87,项目名称:Catel,代码行数:31,代码来源:TypeInfo.cs


示例16: FindMembers

 public override MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria)
 {
     
     Debug.Assert(false, "NYI");
     return base.FindMembers(memberType, bindingAttr, filter, filterCriteria);
 }
开发者ID:hariomrana,项目名称:fsharp,代码行数:6,代码来源:ArtificialType.cs


示例17: CheckMissingAccessor

		void CheckMissingAccessor (MemberKind kind, ParametersCompiled parameters, bool get)
		{
			if (IsExplicitImpl) {
				MemberFilter filter;
				if (kind == MemberKind.Indexer)
					filter = new MemberFilter (MemberCache.IndexerNameAlias, 0, kind, parameters, null);
				else
					filter = new MemberFilter (MemberName.Name, 0, kind, null, null);

				var implementing = MemberCache.FindMember (InterfaceType, filter, BindingRestriction.DeclaredOnly) as PropertySpec;

				if (implementing == null)
					return;

				var accessor = get ? implementing.Get : implementing.Set;
				if (accessor != null) {
					Report.SymbolRelatedToPreviousError (accessor);
					Report.Error (551, Location, "Explicit interface implementation `{0}' is missing accessor `{1}'",
						GetSignatureForError (), accessor.GetSignatureForError ());
				}
			}
		}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:22,代码来源:property.cs


示例18: Resolve

                public override bool Resolve(BlockContext ec)
                {
                    TypeExpression storey_type_expr = new TypeExpression (host.Definition, loc);
                    List<Expression> init = null;
                    if (host.hoisted_this != null) {
                        init = new List<Expression> (host.hoisted_params == null ? 1 : host.HoistedParameters.Count + 1);
                        HoistedThis ht = host.hoisted_this;
                        FieldExpr from = new FieldExpr (ht.Field, loc);
                        from.InstanceExpression = CompilerGeneratedThis.Instance;
                        init.Add (new ElementInitializer (ht.Field.Name, from, loc));
                    }

                    if (host.hoisted_params != null) {
                        if (init == null)
                            init = new List<Expression> (host.HoistedParameters.Count);

                        for (int i = 0; i < host.hoisted_params.Count; ++i) {
                            HoistedParameter hp = (HoistedParameter) host.hoisted_params [i];
                            HoistedParameter hp_cp = (HoistedParameter) host.hoisted_params_copy [i];

                            FieldExpr from = new FieldExpr (hp_cp.Field, loc);
                            from.InstanceExpression = CompilerGeneratedThis.Instance;

                            init.Add (new ElementInitializer (hp.Field.Name, from, loc));
                        }
                    }

                    if (init != null) {
                        new_storey = new NewInitialize (storey_type_expr, null,
                            new CollectionOrObjectInitializers (init, loc), loc);
                    } else {
                        new_storey = new New (storey_type_expr, null, loc);
                    }

                    new_storey = new_storey.Resolve (ec);
                    if (new_storey != null)
                        new_storey = Convert.ImplicitConversionRequired (ec, new_storey, host_method.MemberType, loc);

                    if (TypeManager.int_interlocked_compare_exchange == null) {
                        TypeSpec t = TypeManager.CoreLookupType (ec.Compiler, "System.Threading", "Interlocked", MemberKind.Class, true);
                        if (t != null) {
                            var p = ParametersCompiled.CreateFullyResolved (
                                new[] {
                                    new ParameterData (null, Parameter.Modifier.REF),
                                    new ParameterData (null, Parameter.Modifier.NONE),
                                    new ParameterData (null, Parameter.Modifier.NONE)
                                },
                                new[] {
                                    TypeManager.int32_type, TypeManager.int32_type, TypeManager.int32_type
                                }
                                );
                            var f = new MemberFilter ("CompareExchange", 0, MemberKind.Method, p, TypeManager.int32_type);
                            TypeManager.int_interlocked_compare_exchange = TypeManager.GetPredefinedMethod (t, f, loc);
                        }
                    }

                    ec.CurrentBranching.CurrentUsageVector.Goto ();
                    return true;
                }
开发者ID:speier,项目名称:shake,代码行数:59,代码来源:iterators.cs


示例19: FindMembers

		public virtual MemberInfo[] FindMembers (MemberTypes memberType, BindingFlags bindingAttr,
							 MemberFilter filter, object filterCriteria)
		{
			MemberInfo[] result;
			ArrayList l = new ArrayList ();

			// Console.WriteLine ("FindMembers for {0} (Type: {1}): {2}",
			// this.FullName, this.GetType().FullName, this.obj_address());
			if ((memberType & MemberTypes.Method) != 0) {
				MethodInfo[] c = GetMethods (bindingAttr);
				if (filter != null) {
					foreach (MemberInfo m in c) {
						if (filter (m, filterCriteria))
							l.Add (m);
					}
				} else {
					l.AddRange (c);
				}
			}
			if ((memberType & MemberTypes.Constructor) != 0) {
				ConstructorInfo[] c = GetConstructors (bindingAttr);
				if (filter != null) {
					foreach (MemberInfo m in c) {
						if (filter (m, filterCriteria))
							l.Add (m);
					}
				} else {
					l.AddRange (c);
				}
			}
			if ((memberType & MemberTypes.Property) != 0) {
				PropertyInfo[] c;
				int count = l.Count;
				Type ptype;
				if (filter != null) {
					ptype = this;
					while ((l.Count == count) && (ptype != null)) {
						c = ptype.GetProperties (bindingAttr);
						foreach (MemberInfo m in c) {
							if (filter (m, filterCriteria))
								l.Add (m);
						}
						ptype = ptype.BaseType;
					}
				} else {
					c = GetProperties (bindingAttr);
					l.AddRange (c);
				}
			}
			if ((memberType & MemberTypes.Event) != 0) {
				EventInfo[] c = GetEvents (bindingAttr);
				if (filter != null) {
					foreach (MemberInfo m in c) {
						if (filter (m, filterCriteria))
							l.Add (m);
					}
				} else {
					l.AddRange (c);
				}
			}
			if ((memberType & MemberTypes.Field) != 0) {
				FieldInfo[] c = GetFields (bindingAttr);
				if (filter != null) {
					foreach (MemberInfo m in c) {
						if (filter (m, filterCriteria))
							l.Add (m);
					}
				} else {
					l.AddRange (c);
				}
			}
			if ((memberType & MemberTypes.NestedType) != 0) {
				Type[] c = GetNestedTypes (bindingAttr);
				if (filter != null) {
					foreach (MemberInfo m in c) {
						if (filter (m, filterCriteria)) {
							l.Add (m);
						}
					}
				} else {
					l.AddRange (c);
				}
			}

			switch (memberType) {
			case MemberTypes.Constructor :
				result = new ConstructorInfo [l.Count];
				break;
			case MemberTypes.Event :
				result = new EventInfo [l.Count];
				break;
			case MemberTypes.Field :
				result = new FieldInfo [l.Count];
				break;
			case MemberTypes.Method :
				result = new MethodInfo [l.Count];
				break;
			case MemberTypes.NestedType :
			case MemberTypes.TypeInfo :
				result = new Type [l.Count];
//.........这里部分代码省略.........
开发者ID:runefs,项目名称:Marvin,代码行数:101,代码来源:Type.cs


示例20: GetPredefinedMethod

	public static MethodSpec GetPredefinedMethod (TypeSpec t, MemberFilter filter, bool optional, Location loc)
	{
		return GetPredefinedMember (t, filter, optional, loc) as MethodSpec;
	}
开发者ID:telurmasin,项目名称:mono,代码行数:4,代码来源:typemanager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MemberFlags类代码示例发布时间:2022-05-24
下一篇:
C# MemberDeclarationSyntax类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap