EDN Admin
Well-known member
Okay, I have a custom class called "Time" with the following function, for determining if one Time equals another Time.
<pre class="prettyprint lang-vb Public Shared Shadows Function Equals(ByVal Time1 As Time, ByVal Time2 As Time) As Boolean
Dim x(2) As Integer
x(0) = CInt(Time1.Hour)
x(1) = CInt(Time1.Minute)
x(2) = CInt(Time1.Second)
Dim y(2) As Integer
y(0) = CInt(Time2.Hour)
y(1) = CInt(Time2.Minute)
y(2) = CInt(Time2.Second)
If x(0) = y(0) And x(1) = y(1) And x(2) = y(2) Then
Return True
Else
Return False
End If
End Function[/code]
Syntax:
<pre class="prettyprint lang-vb If Time.Equals(FirstTime, SecondTime) Then
Times are equal
End If[/code]
Im being thrown a warning (not error):
Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
I know it shouldnt do any harm, just let the compiler skip evaluation, but <span style="text-decoration:underline
is it a way of getting rid of this warning?
Here is the entire class, if you would need it: http://pastebin.com/gHZ1Utwb" target="_blank http://pastebin.com/gHZ1Utwb
Sincerely yours,<br/>
- bilde2910 <hr class="sig If a post is helpful to you or solves a problem, remember to mark it as answer, propose it as answer or vote up.<br/>
http://bit.ly/b2910sd Check out my development so far!
View the full article
<pre class="prettyprint lang-vb Public Shared Shadows Function Equals(ByVal Time1 As Time, ByVal Time2 As Time) As Boolean
Dim x(2) As Integer
x(0) = CInt(Time1.Hour)
x(1) = CInt(Time1.Minute)
x(2) = CInt(Time1.Second)
Dim y(2) As Integer
y(0) = CInt(Time2.Hour)
y(1) = CInt(Time2.Minute)
y(2) = CInt(Time2.Second)
If x(0) = y(0) And x(1) = y(1) And x(2) = y(2) Then
Return True
Else
Return False
End If
End Function[/code]
Syntax:
<pre class="prettyprint lang-vb If Time.Equals(FirstTime, SecondTime) Then
Times are equal
End If[/code]
Im being thrown a warning (not error):
Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
I know it shouldnt do any harm, just let the compiler skip evaluation, but <span style="text-decoration:underline
is it a way of getting rid of this warning?
Here is the entire class, if you would need it: http://pastebin.com/gHZ1Utwb" target="_blank http://pastebin.com/gHZ1Utwb
Sincerely yours,<br/>
- bilde2910 <hr class="sig If a post is helpful to you or solves a problem, remember to mark it as answer, propose it as answer or vote up.<br/>
http://bit.ly/b2910sd Check out my development so far!
View the full article