Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
13
Reply
How to assign TimeSpan with a default value when using it as an argument?
time and space
Jul 25 2011 7:35 AM
15.5k
Reply
This does not work:
public void DoStuff(TimeSpan interval = TimeSpan.FromSeconds(5))
The compiler error is: "Error 1 Default parameter value for 'interval' must be a compile-time constant".
I have tried making a const field in the class but still no luck.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
13
)
Next Recommended Forum
Multiple assignment vs object creation
How to bloom a specific color or sprite?