473,386 Members | 1,734 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,386 software developers and data experts.

Instance attribute values

Is there any way to have an attribute with a value that is unique to an
instance of an object? For example, let say I have the following:

Public Class MyAttribute
Inherits System.Attribute
Public Value As Boolean
Public Sub New(ByVal value As Boolean)
Me.Value = value
End Sub
End Class

Public Class MyClassWithAttribute
<MyAttribute(True)> _
Public Property SomeProperty As Object
...
End Property
End Class

Public Class MyWorkingClass
Public myClassWithAttribute1 As New MyClassWithAttribute
Public myClassWithAttribute2 As New MyClassWithAttribute
...
End Class

Now, what I want to do is to be able to set MyAttribute.Value of
myClassWithAttribute1.SomeProperty to False, but to keep MyAttribute.Value of
myClassWithAttribute2.SomeProperty set to True. Is this possible?

Thanks,
Lance

Nov 21 '05 #1
0 849

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

Similar topics

8
by: Matthew Bell | last post by:
Hi, I've got a question about whether there are any issues with directly calling attributes and/or methods of a threaded class instance. I wonder if someone could give me some advice on this. ...
4
by: Donnal Walter | last post by:
This is a question about Python patterns or idioms. Over a period of time, I have evolved a pattern of usage that seems to work better for me than other ways I tried previously, but in writing some...
2
by: Sean | last post by:
Hi, I am facing a problem, and i don't know why the error is being generated. I am updating a datagrid with an XML file. My code is Protected Sub UpdateCommand(ByVal Sender As Object,...
7
by: Tiësto | last post by:
Hi everybody. I know everyone has said to me that this doesn't exist but I'm going to try anyway. I have an instance of ClassA and I want to duplicate that instance, creating another one that is...
10
by: John M. Gabriele | last post by:
The following short program fails: ----------------------- code ------------------------ #!/usr/bin/python class Parent( object ): def __init__( self ): self.x = 9 print "Inside...
5
by: Russell Warren | last post by:
I just ran across a case which seems like an odd exception to either what I understand as the "normal" variable lookup scheme in an instance/object heirarchy, or to the rules regarding variable...
7
by: Simon Bunker | last post by:
Hi I have code similar to this: class Input(object): def __init__(self, val): self.value = val def __get__(self, obj, objtype): return self.value
6
by: =?Utf-8?B?SmFzb24gUmV5bm9sZHM=?= | last post by:
(using .net 2.0) Say you have a class structure like this: class Address .... end class class Person FirstName
5
by: feli.hp | last post by:
Hello all, Imaybe someone can help me with this question. Is there a direct way of accessing an object instance, if all I know is the value of one of its attributes? The object is part of a...
1
by: BrendanC | last post by:
I'm trying to understand reflection/introspection in Python. How can I identify the the type of attribute (e.g. instance var) in a class? The following returns all the class attributes (methods and...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.