Hi,
Have an executable which can activate one of 2 silngeltones.
I think you mean "singleton" :)
I need an enumerator in order to let the mrethods inside singletone know
if they were activated from executable or maybe from some other place.
By "enumerator" do you mean "enum"?
You have to be clear about this since they are two very different things,
although using an enumerator for the described behavior doesn't make sense.
An enumerator is used to iterate over a collection. An enum (enumeration)
is a type that you can define to contain named integral constants. You can
define an enum like this:
public enum Vehicle
{
Car, // = 0
Truck, // = 1
Boat, // = 2
Plane // = 3
}
You don't have to but you can assign each constant a numeric value if
desired. If you're using FlagsAttribute on your enum then you'll probably
want to assign each constant to a distinct value that is bit aligned (to
serve as bit flags):
[Flags]
public enum Vehicles // note the pluralization (s) to indicate Flags
{
None = 0,
Car = 1,
Truck = 2,
Boat = 4,
Plane = 8,
ByLand = Car | Truck // = 3
}
You probably won't need to use flags but I included an example anyway for
the sake of completeness. To use the first (non-flags) enum you can pass
one of its values to a method like this:
void CallMyMethod()
{
MyMethod(Vehicle.Car);
}
void MyMethod(Vehicle vehicle)
{
Console.WriteLine(vehicle); // writes Car
}
For more info:
"C# Programmer's Reference, enum (C# Reference)"
http://msdn2.microsoft.com/en-us/library/sbbt4032.aspx
I prefer no to path this enumarator in sigeltone methods arguments.
I don't understand what you mean here. Could you please clarify this
requirement?
--
Dave Sexton