what is the Value in Cycle struct

B

bobby

hi,

I came across this code which is struct Cycle and in 13 line there is
something (public int Value) that I do not understand what it is.
Is it a method or a variable?
Thanks for the help

Here is the code

struct Cycle
{
// Private fields
int _val, _min, _max;

// Constructor
public Cycle(int min, int max)
{
_val = min;
_min = min;
_max = max;
}

public int Value
{
get { return _val; }
set
{
if (value > _max)
_val = _min;
else
{
if (value < _min)
_val = _max;
else
_val = value;
}
}
}

public override string ToString()
{
return Value.ToString();
}

public int ToInteger()
{
return Value;
}

// Operators (new in .NET 2.0)
public static Cycle operator +(Cycle arg1, int arg2)
{
arg1.Value += arg2;
return arg1;
}

public static Cycle operator -(Cycle arg1, int arg2)
{
arg1.Value -= arg2;
return arg1;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top