473,671 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listing all class properties

Stu
Hi,

I have a class with quite a large number of properties that stores booking
information.. I need to create an audit trail for these bookings every time
something is changed. I thought about listing all the properties in the
class and their values and writing a text file for each time the booking
information is changed.

2 questions:
1 - Does this sound like a good way of doing it?
2 - Is there any way of enumerating all of the properties & their values?

Thanks in advance,

Stu
Nov 21 '05 #1
2 1001
You can do that by reflection, by calling the GetMembers() method of a Type
object. The following code is just what you asked (except it is in C#):

http://www.devx.com/tips/Tip/21232

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Stu" <s.****@cergis. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

I have a class with quite a large number of properties that stores booking
information.. I need to create an audit trail for these bookings every time something is changed. I thought about listing all the properties in the
class and their values and writing a text file for each time the booking
information is changed.

2 questions:
1 - Does this sound like a good way of doing it?
2 - Is there any way of enumerating all of the properties & their values?

Thanks in advance,

Stu

Nov 21 '05 #2
Do the reflection give the value of the property at run -time?

If it is just to view the members of each class , then it can also be done
using the class view in the VIEW menu.

nafri
"Manohar Kamath" wrote:
You can do that by reflection, by calling the GetMembers() method of a Type
object. The following code is just what you asked (except it is in C#):

http://www.devx.com/tips/Tip/21232

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Stu" <s.****@cergis. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

I have a class with quite a large number of properties that stores booking
information.. I need to create an audit trail for these bookings every

time
something is changed. I thought about listing all the properties in the
class and their values and writing a text file for each time the booking
information is changed.

2 questions:
1 - Does this sound like a good way of doing it?
2 - Is there any way of enumerating all of the properties & their values?

Thanks in advance,

Stu


Nov 21 '05 #3

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

Similar topics

21
4064
by: Jon Slaughter | last post by:
I have a class that is basicaly duplicated throughout several files with only members names changing according to the class name yet with virtually the exact same coding going on. e.g. class A { std::vector<B*> Bs; public:
4
1545
by: jbesr1230 | last post by:
Hello, How would I print out a listing of the queries that are in a database? I would like to have a spreadsheet style listing with the columns of: Query Name, Description, Modified Date, Created Date. Thanks. JBESr
4
1936
by: Jonny | last post by:
I'm sure this is easy and i'll kick myself for it. How would i go about listing all the machines on a domain? I want to display them in a list box. Thanks /Jonny
1
3343
by: Jerry Negrelli | last post by:
Can anyone help translate this into C#??? It's supposed to list all subnets in all AD sites (see URL below). I placed it in a VB class library (one class with one "Function", WScript.Echo replaced with a string concat & return statement) and tried to reference it that way, but I kept getting "object not an instance" errors. Rather than try to debug that approach in that pea soup language, I'd rather just rewrite it in C# so I can see...
9
2221
by: David A. Osborn | last post by:
I have a set of classes that each have an enumeration in them, and based on dynamic input I need to access a different enumeration. For example Three classes Class_A, Class_B, and Class_C that all have a different enumeration in them called Properties. I want to basically have a variable The_Class that I can dynamically point to either Class_A, Class_B, or Class_C and then do The_Class.properties to get the correct enumeration. How...
8
1854
by: Lüpher Cypher | last post by:
Hi, Suppose we have a hierarchical class structure that looks something like this: Object | +-- Main | +-- Object1
2
1457
by: usenet | last post by:
I am trying to collect a comprehensive listing of standard C++ exceptions. This is what I have got so far (by going through the standard). Kindly let me know if I missed anything. Thanks, Ramesh // // ********* Derived from std::exception ********* //
4
1053
by: John | last post by:
Hi Is there an easy or a built-in way to collect all properties of an object into a string variable for debugging purpose? I am looking for something similar to this; "Property1: Property1value Property2: Property2value Property3: Property3value .....
5
1672
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
Suppose I define a class with a number of variables defined as properties. Something like: class MyClass(object): def __init__(self): self.some_variable = 42 self._a = None self._b = "pi"
0
8472
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, 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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8909
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8596
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
8667
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
6222
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
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
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
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.