TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kieth biasillo
NA
3
2.6k
incrementing control number value(via static property????)
Aug 16 2010 2:17 PM
I am not a C# programmer, but I have created an app and the final piece that I would like to have function is a static value that I can access and increment by 1 each time I issue a new control number to an output document.
I was reading that static properties might be a good thing for this. I have the following code for the static property but not sure how to initialize it to say 000000001 and GET then SET value++ each time I use it. I also dont know if this is a better solution than say a file containing the control number and just reading then updating the file. what is the longevity of the value contained in the static property?
so my questions are as follows:
1 how do I initialize this based on the code below
2 how do I increment this number , in the method or in the class calling the method?
3 is this a good idea or should I stick with a file or database to carry the control number
using
System;
namespace
GeneralApp{
static
class
InterchangeControlNumberCounter
{
public
static
int
ControlNumber
{
get
{
return
ControlNumber;
}
set
{
ControlNumber++;
}
}
}
}
thank you
Reply
Answers (
5
)
how to Export data Grid View values into Excel using C#
TCP Sockets