dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB7
Expertise: Intermediate
Nov 4, 2002

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


FilterByName - filtering by name the results of Type.FindMembers

' This filtering function returns True if the member name 
' begins with the character passed as its second argument.
' Note: it requires Imports System.Reflection
Function FilterByName(ByVal m As MemberInfo, ByVal filterCriteria As Object) As _
    Boolean
    If m.Name.StartsWith(filterCriteria.ToString) Then
        Return True
    End If
End Function


' EXAMPLE:
' Get a reference to the System.String type.
Dim stringType As Type = Type.GetType("System.String")
Dim minfos() As MemberInfo

' Get only public, instance methods and properties
' whose name begins with "C".
minfos = stringType.FindMembers(MemberTypes.Method Or MemberTypes.Property, _
    BindingFlags.Public Or BindingFlags.Instance, AddressOf FilterByName, "C")

' List the results.
Dim mi As MemberInfo
For Each mi In minfos
    Debug.WriteLine(mi.Name)
Next


' Note: This code is taken from Francesco Balena's
' "Programming Microsoft Visual Basic .NET" - MS Press 2002, ISBN 0735613753
' You can read a free chapter of the book at 
' http://www.vb2themax.com/HtmlDoc.asp?Table=Books&ID=101000
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date