I received this error on following code.Is this + sign is not available in C# ?
Error : Operator ‘+’ cannot be applied to operands of type ‘System.date.time’ and ‘char’
return StartDate +';'+EndDate;
EDIT :
After the answers i edited code like this.but then i got those error
return StartDate.ToString() + ';' + EndDate.ToString();
Error : Since Hdate.HDate(); return void,a return keyword must not be followed by an object expression
The Whole Code is here :Click Here to see whole code
Just use “;” instead of ‘;’:
There is a + operator for strings (Concat) and it will operate on objects (with .ToString()) – so the statement is valid if you give a string.
In your case there is none such operator for characters and the compiler cannot know that you implicitly want to convert everything to string.
EDIT: to your second problem (consider making it a new question in the future):
straight from your code (full version):
you see: this is a constructor for your
HDatetype – and you return something in the last statment … but you MUST not