C# Changing a constant
Posted
by Jane T
on Stack Overflow
See other posts from Stack Overflow
or by Jane T
Published on 2010-03-16T11:44:37Z
Indexed on
2010/03/16
11:46 UTC
Read the original article
Hit count: 320
c#
I have inherited a small windows form based program written in C# that uses a 'constant' (See below), I need to modify this program so 'PROPERTY_NAME' can be "jobs" and "careers".
private const string PROPERTY_NAME = "jobs";
I'm guessing a constant isn't designed to change so should I need to change this. The line above is set once at the top of a class file and then PROPERTY_NAME is used throughout that file.
On the main form I would like to add two radio buttons 1 called 'jobs' and one called 'careers' and then change the PROPERTY_NAME in the class file based on which is selected. Would I need to pass the radio button status to the method in the class file? I recall reading that I can't simply read the radio button value from the class file.
Many thanks for your advice.
Jane
© Stack Overflow or respective owner