I have a php code like this,going to convert it in to C#.
function HuntingDate()
{
Global $nameofselectbox,$startYear,$endYear,$year,
$startDate,$endDate,$startMounth,$endMounth,$startDay,$endDay;
$today = getdate();
$year=$today['year'];
$mounth=$today['mon'];
$day=$today['mday'];
Here is my try( I tried to use enum for this)
public enum HuntingDate{string StartYear,string EndYear,string Year,string StartDate,string EndDate,string StartMonth,string EndMonth,stirng StartDay,string EndDay}
Can i do thisone with enum ? i got the error “Identifier expected,String is a keyword”
No not with enum, you should use a class for this:
you then have further things to consider:
Strings are not ideal for date type data, for this consider using DateTime – with this you can merge the year, month and day values into one property:
Classes are used to define the structure of an object, as my example stands you would need to create an instance of the class in order to use it:
with this you have to consider where you want to have access to it. If you need a global accessible instance you could initialise the class at a global scope level, or consider using a static class (though it should be noted that these values would be persisted across the whole application):
I would strongly suggesting doing some reading on C# (get a book!) if you want to do this more seriously you should get a solid grasp of the basics of C#