TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
time and space
1.7k
31
57.3k
How to assign TimeSpan with a default value when using it as an argument?
Jul 25 2011 7:35 AM
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.
Reply
Answers (
13
)
Multiple assignment vs object creation
How to bloom a specific color or sprite?