Reputation: 66995
In as3 I'd say
public var time:Number;
How to declare such in C#?
Upvotes: 0
Views: 1912
Reputation: 11
If you are looking for small integer:
public int Number; // This stores whole numbers. e.g., 3, 9 , -3.
public float Number; // This stores numbers with decimals. e.g., 3.27, -3.45
Upvotes: 1
Reputation: 10377
See "Types".
You probably want an int, long, float, double, decimal - or maybe DateTime or TimeSpan.
Upvotes: 4
Reputation: 4302
AS3 Number is most closely represented by a double in C#
public double time;
Upvotes: 4
Reputation: 15795
Depending on the type you want:
public double time;
or you could use the DateTime
struct provided by .NET
public DateTime time;
or really, you would probably want to create auto-properties for these like this:
public double Time {get;set;}
or
public DateTime Time {get;set;}
Upvotes: 2
Reputation: 171589
C# has a a DateTime
data type, so for dates I would create a variable like this:
public DateTime time;
This lets you do things like subtract dates, and make use of the TimeSpan
structure.
Upvotes: 1
Reputation: 61497
public decimal time;
decimal depending of course on the type you want.
Upvotes: 1
Reputation: 138982
public long time;
This will create a new variable with the type long
and the default value. (0
)
Upvotes: 1