Hello,
I need add new method to my properties. these methods should give me
some attributes coming from my database.
I think, to create a class with implement PropertyInfo but I don't know
how To call my custom class.
My code like this :
public abstract class Class2 : PropertyInfo //, RuntimeProperty Info
{
public override System.Reflecti on.PropertyAttr ibutes Attributes
{
get { throw new Exception("The method or operation is not
implemented."); }
}
public override bool CanRead
{
get { throw new Exception("The method or operation is not
implemented."); }
}
public override bool CanWrite
{
get { throw new Exception("The method or operation is not
implemented."); }
}
public override MethodInfo[] GetAccessors(bo ol nonPublic)
{
throw new Exception("The method or operation is not
implemented.");
}
public override MethodInfo GetGetMethod(bo ol nonPublic)
{
throw new Exception("The method or operation is not
implemented.");
}
public override ParameterInfo[] GetIndexParamet ers()
{
throw new Exception("The method or operation is not
implemented.");
}
public override MethodInfo GetSetMethod(bo ol nonPublic)
{
throw new Exception("The method or operation is not
implemented.");
}
public override object GetValue(object obj, BindingFlags
invokeAttr, Binder binder, object[] index,
System.Globaliz ation.CultureIn fo culture)
{
throw new Exception("The method or operation is not
implemented.");
}
public override Type PropertyType
{
get { throw new Exception("The method or operation is not
implemented."); }
}
public override void SetValue(object obj, object value,
BindingFlags invokeAttr, Binder binder, object[] index,
System.Globaliz ation.CultureIn fo culture)
{
throw new Exception("The method or operation is not
implemented.");
}
public override Type DeclaringType
{
get { throw new Exception("The method or operation is not
implemented."); }
}
public override object[] GetCustomAttrib utes(Type attributeType,
bool inherit)
{
throw new Exception("The method or operation is not
implemented.");
}
public override object[] GetCustomAttrib utes(bool inherit)
{
throw new Exception("The method or operation is not
implemented.");
}
public override bool IsDefined(Type attributeType, bool inherit)
{
throw new Exception("The method or operation is not
implemented.");
}
public override string Name
{
get { throw new Exception("The method or operation is not
implemented."); }
}
public override Type ReflectedType
{
get { throw new Exception("The method or operation is not
implemented."); }
}
private bool myEnable;
public bool getEnable()
{
return myEnable;
}
public void setEnable(bool enable_)
{
myEnable= enable_;
}
}
And, I would take a property from another class and check the boolean
enable with the get and set ...
Any Idea...
Thanks 0 1415 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Tullemans |
last post by:
I am trying to write a subroutine that will examine all
the properties of a form to determine which of those are
SqlCommand objects, and then set the Connection property
of those SqlCommands to a passed-in SqlCommand object. I
can find the properties OK but am unsuccessful in trying
to change their value due to the way I have identified...
|
by: David |
last post by:
Basically, my class has a reference type as one of its property. For
example
- Employee class has a perperty called Name
- Name is a class with string properties - FirstName, LastName, MiddleName,
MaindenName, etc.
- To get to the employee's FirstName, it would be employee.Name.FirstName
At run time, I have the string path to the...
|
by: Picho |
last post by:
Hi guys
is it possible, once getting hold of a propertyInfo instance to know when
the value of the property changed?
that is without requiring the property to raise an event on change
obviously...
maybe something with the PropertyInfo.GetSetMethod()? monitoring when that
method is called somehow?
|
by: Charles Law |
last post by:
I have adapted the following code from the MSDN help for PropertyInfo
SetValue. In the original code, the structure MyStructure is defined as a
class MyProperty, and it works as expected. There is also a minor change in
class Mypropertyinfo, which I have commented out.
When using a structure, however, the second call to GetValue returns...
|
by: SyZLaB |
last post by:
I had a problem using system.reflection.propertyinfo.getvalue in vb -
and searched a lots of newsgroups and libraries - but none had the
solution to my problem - and it also seamed like many others had the
same problem: system.reflection.propertyinfo.getValue fails with
"Object does not match target type."
As many of the posts where to old...
| |
by: ricolee99 |
last post by:
Hi everyone,
I have a problem that i have been trying to solve for awhile. I'm
given a code where the purpose is to create a general dataset mapper.
Given any dataset, i have a class, "Mapper.cs" that's supposed to map
objects from any type of dataset to any type of object.
Inside Mapper.cs, there's a method,
object Map(Type...
|
by: Carlos Rodriguez |
last post by:
I have the following function in C#public void Undo(IDesignerHost host)
{
if (!this.componentName.Equals(string.Empty) && (this.member != null))
{
IContainer container1 = (IContainer)
host.GetService(typeof(IContainer));
IComponent component1 =
container1.Components;
PropertyInfo info1 =
component1.GetType().GetProperty(this.member.Name);
|
by: koonda |
last post by:
Hi all,
I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can...
|
by: FourEyes |
last post by:
I've read that Reflection is slow and shouldn't be used when
performance is a concern. In my case, performance is definitely a
concern, so I was thinking that I could collect the PropertyInfo
objects that I need at initialization, and then just call
PropertyInfo.SetValue() at runtime. Can anyone tell me 1) how
expensive is the call to...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |