C# string to date conversion problem

I am trying to concatenate a string ("01/01/" to an int (ResidencyConstants.ResidencyYear) and get a Date

If (ExistingResident) return ("01/01/" + ResidencyConstants.ResidencyYear);

All I want is to return a Date of Jan 1 of the Residency Year In this instance it would return 01/01/2012 as a Date

The error I get is "Cannot implicitly convert type 'string' to 'System.Date'"
PSCTECHAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
Use datetime's parse method to parse it and return as a datetime object

If (ExistingResident) return datetime.parse("01/01/" + ResidencyConstants.ResidencyYear);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
Assuming you need to return a date then actually return a date, not a string.  eg.
If (ExistingResident) return new DateTime(ResidencyConstants.ResidencyYear,1,1);
PSCTECHAuthor Commented:
I had to use Date instead of DateTime, but it worked perfectly.  Thank you for the quick response and accurate solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.