473,473 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Resetting all object variables in c#

lee
I wont to reset all the variables in a c# object at run time, I was hoping
for a field collection or some similar method of iterating through the
variables.

Any ideas ???

--
Lee.
Jul 21 '05 #1
4 4800
lee <le*@discussions.microsoft.com> wrote:
I wont to reset all the variables in a c# object at run time, I was hoping
for a field collection or some similar method of iterating through the
variables.

Any ideas ???


Well, you could use reflection. It won't be terribly fast though...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Why not having a Reset something method on that object, doing it for you.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m...
lee <le*@discussions.microsoft.com> wrote:
I wont to reset all the variables in a c# object at run time, I was
hoping
for a field collection or some similar method of iterating through the
variables.

Any ideas ???


Well, you could use reflection. It won't be terribly fast though...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #3
Dennis Myrén <de****@oslokb.no> wrote:
Why not having a Reset something method on that object, doing it for you.


Yes, that's certainly the better bet if you are in control of the type.
Of course it means you've got to modify the method every time you add a
field, too. I was assuming that the OP didn't want to do that for
whatever reason, but I think they'd have to be pretty good reasons :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
Or also just creating a new instance...

Patrice

--

"Dennis Myrén" <de****@oslokb.no> a écrit dans le message de
news:Zo********************@news4.e.nsc.no...
Why not having a Reset something method on that object, doing it for you.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP***********************@msnews.microsoft.co m...
lee <le*@discussions.microsoft.com> wrote:
I wont to reset all the variables in a c# object at run time, I was
hoping
for a field collection or some similar method of iterating through the
variables.

Any ideas ???


Well, you could use reflection. It won't be terribly fast though...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Jul 21 '05 #5

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

Similar topics

1
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
4
by: Israel Ordonez Jr | last post by:
Hi everybody, I am having a problem with an ASP.NET application i am working on. I new to ASP.NET so I'm not sure if I'm doing this right. I am working on a website that has an oil price listed...
7
by: Tym | last post by:
Made the change from vb6 to vb.net and have found that DoEvents() doesn't work!! Well, the replacement System.Windows.Forms.Application.DoEvents() is causing hell!! I have a loop such as
4
by: lee | last post by:
I wont to reset all the variables in a c# object at run time, I was hoping for a field collection or some similar method of iterating through the variables. Any ideas ??? -- Lee.
3
by: CBKowitz | last post by:
Has anyone encountered this problem? I start debugging my application and the session get reset (as far as I can tell). I then stop and restart and everything is fine. Basically the symptoms...
4
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I...
2
by: tshad | last post by:
I have my Application variables getting set in my Global.aspx file. If I change a variable in my table that is read at startup, I need to restart the application to reload the variables. I...
8
LacrosseB0ss
by: LacrosseB0ss | last post by:
Hey folks; I have PHP session variables that are having some troubles. I posted in a few other forums but couldn't really find one dedicated to my specific issue. I am using a few session variables...
6
by: JohnSmith70 | last post by:
Lets say I have a class, which creates object and variables. In main how do I reset that class to null, as if it was (the class run for the first time) first run, but without exitting the main?
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...
1
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...
0
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...
0
agi2029
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,...
1
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...
0
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...
0
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 ...
0
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...

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.