ucasesoftware,
In addition to the other comments.
The C# code is relying on overloaded operators. The = operator is overloaded
in the TimeSpan class to support comparing 2 TimeSpan values.
ap.DateBegin.TimeOfDay is a TimeSpan
TimeSpan.Zero is also a TimeSpan.
The C# compiler is using TimeSpan.op_Equal to compare the two values.
op_Equal is the special name for the overloaded = operator.
As Armin shows in VB 2002 & 2003 you need to use TimeSpan.Equals,
TimeSpan.Compare, or TimeSpan.op_Equals to compare the two values.
Fortunately! (Hurrah!) VB 2005 fully supports overloaded operators so you
can use your code "as is".
NOTE: Be careful with the Equals method & structures, such as TimeSpan, as
Equals overridden from System.Object takes Object parameters & will cause
boxing. I normally offer type safe Equals methods on my structures so as to
avoid this boxing. In the case of TimeSpan.Equals(x, y) there is an overload
that accepts TimeSpans hence avoiding the boxing.
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"ucasesoftware" <uc***********@hotmail.fr> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
|i translate a C# funtion to VB.NET and i have this :
|
| Shared Function isAllDay(ByVal ap As Appointment) As Boolean
| Return ap.DateBegin.TimeOfDay = TimeSpan.Zero AndAlso
| ap.DateEnd.TimeOfDay = TimeSpan.Zero
| End Function
|
| Error :
| = is not corret
|
| so i try " is TimeSpan.zero"
|
| Error again ?!!!
|