473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

When NOT to Reflection

Hello,

I found a reply by Peter Huang to a previous post quite valuable with regard
to referencing controls on a form by name using reflection. It made me
wonder when I would not use Reflection for this task (or any other similar
task). So, I thought I'd ask the question ... when is Reflection not an
appropriate solution (especially with regard to getting controls by name)?

Thanks!
Jack
Nov 21 '05 #1
4 875
Jack,
So, I thought I'd ask the question ... when is Reflection not an
appropriate solution (especially with regard to getting controls by name)?


For me has this a simple answer *forever* when you don't need it. It is just
late binding.

In addition I don't see any problem to solve with it which cannot be done
better without it, with the exception maybe when you are building your own
compiler or something like that.

Cor
Nov 21 '05 #2
"jack" <ja***@systemsynergy.com.dumpthispart> schrieb:
I found a reply by Peter Huang to a previous post quite valuable with
regard to referencing controls on a form by name using reflection. It made
me wonder when I would not use Reflection for this task (or any other
similar task). So, I thought I'd ask the question ... when is Reflection
not an appropriate solution (especially with regard to getting controls by
name)?


Reflection will only work in this case when there is a variable referencing
the control. It won't work for controls added at runtime which do not
belong to a member variable.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Thanks for the feedback. Previously, I loaded the controls into a hash table
when the form loaded. I guess your recommendation is to go back to that
method?

Jack
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
Jack,
So, I thought I'd ask the question ... when is Reflection not an
appropriate solution (especially with regard to getting controls by name)?


For me has this a simple answer *forever* when you don't need it. It is
just late binding.

In addition I don't see any problem to solve with it which cannot be done
better without it, with the exception maybe when you are building your own
compiler or something like that.

Cor

Nov 21 '05 #4
Jack,
Thanks for the feedback. Previously, I loaded the controls into a hash
table when the form loaded. I guess your recommendation is to go back to
that method?


How did you know that, I had the idea to write that already in my first
message.

Cor
Nov 21 '05 #5

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

Similar topics

0
by: A. Wiebenga | last post by:
Hi all! I am a student at the Hogeschool van Arnhem en Nijmegen in Holland. I am currently involved in a research project regarding Reflection. Purpose of the research project is to document...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
2
by: Mark | last post by:
Am I out of my mind if I use Reflection everytime someone logs into our site to get and track the current Major/Minor/Build/Revision version that the person is viewing our site through? This...
5
by: heddy | last post by:
I understand that reflection allows me to discover the metadata of a class at runtime (properties, methods etc). What I don't understand is where this is useful. For example: If I am the sole...
3
by: jmbernz | last post by:
I really need help with this one, I'm trying to set the app icon during run time. There is no problem when the app is not group together, it still have the set icon but when group together if you...
9
by: Kuberan Naganathan | last post by:
Hello all Does anyone know of a good way to use reflection in c++? I don't mean simply using rtti or dynamic casting. I'm talking about java/c# style reflection where an actual instance of...
15
by: =?Utf-8?B?VG9tIENvcmNvcmFu?= | last post by:
I've been led to believe by several articles, particularly Eric Gunnerson's C# Calling Code Dynamically, that calling a method dynamically through Reflection was much slower than through a...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: Gustavo Arriola | last post by:
Hola a todos! Estoy intentando ejecutar un método usando Reflection. El código es el siguiente: public static void SoapHandler(Exception Error) { try { Type assemblyType;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.