473,785 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get & Set property methods show up in System.Reflecti on.MethodInfo

Does anyone know of a way that you can use
System.Reflecti on.MethodInfo to get a list of methods within a class
and NOT have it show the Get and Set methods of properties?
Nov 16 '05 #1
3 5353
Doug,
Does anyone know of a way that you can use
System.Reflect ion.MethodInfo to get a list of methods within a class
and NOT have it show the Get and Set methods of properties?


Can't you just manually filter out any methods with names that start
with "get_" or "set_" and has IsSpecialName=t rue?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2
I can, and actually decided to do that, however, with the way things
change, if Microsoft ever changes how they name methods for properties
(i.e. if they switch it from "get_PROPERTYNA ME" to "GetPROPERTYNAM E"
or even "PROPERTYNAMEGe t" or maybe "PROPERTYNAME_G et") then my code is
hosed. It's the lesser of two evils right now but I was hoping for a
better solution if one is out there.
Nov 16 '05 #3
>It's the lesser of two evils right now but I was hoping for a
better solution if one is out there.


Well you could also get the list of all properties with
Type.GetPropert ies(), then for each property, remove the getter and
setter methods (PropertyInfo.G etGetMethod()/.GetSetMethod() ) from the
set of all methods you get from Type.GetMethods ().

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2626
by: Mike Malter | last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I can call that method again later using reflection. I am experimenting a bit with what I need to do this and have the following code snippet. But first if I pass the assembly name and type to Activator.CreateInstance() it always fails. However if I walk my assembly and get a type value, the call to...
4
1852
by: Ahmet | last post by:
Hi all; I have one application in which I read form names from database to be opened. I open form with the code below, and call its show method for form to be shown but before this, I must set MdiChild property to true to make this form child I can call functions as you can see like (show), how can i set.MdiParent = this property of dynamically loaded form ? Or I can call a form function dynamically with parameter ?...
9
1422
by: Oriane | last post by:
Hi, I'm currently a method attribute which is used to check the "validity" of this method against a rule. I wrote the isValid method, to be used inside the otriginal method: For instance: // Following is Csharp code private void functionT12 ()
0
1361
by: Vamsi T via DotNetMonster.com | last post by:
Hi, I'm using .NET CF 2.0. I have a problem in retrieving the exact methods of a Class in CF. When I do a type.GetMethods() (where type is System.Xml.XPath. XPathException for example), I get get_HelpLink (GetProperties also returns HelpLink) which is not available in CF. I'm loading the exact System.Xml.dll from the CF directory using ReflectionOnlyLoadFrom. So the dll being probed is correct but the methods being returned are not the...
4
2456
by: Dov Tendler | last post by:
Hi All, I would like to get MethodInfo of current instantiated generic method call. Consider the following function call: C.f<int>(5); Where f is defined as follows: class C {
1
8039
by: Guido Kraus | last post by:
Hi, I wonder how to get the name of the currently executing property by using reflection in .Net 2.0 If I use System.Reflection.MethodInfo.GetCurrentMethod().Name from within a property I get something like "set_MyProperty" instead of "MyProperty". Is there a way to get the current property name without the "set_" or "get_" prefix?
0
5576
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
4
4129
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I have a user control that is designed as below. I am creating these User Controls Dynamically in another form. They are multiple types of User Controls all with a common Interface so I can use a Factory to create them all in a generic way. The problem is that if I create a IMyInterface - I cannot access the derived UserControl Methods. I need to access the Methods derived from UserControl and also the Interface
9
1943
by: =?Utf-8?B?VmljdG9y?= | last post by:
Is it a way to discover, at the run time, the name of a property of an object? In other words is it possible to create a method GetPropertyName, that takes a property of an object and returns the name of that property? So: string name = GetPropertyName(int.MaxValue); // returns “MaxValue†string name = GetPropertyName(DateTime.Now); // returns “Now†(Something similar exists to...
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.