# if statement c#

I have a reader but i am converting to c# from vb. what is the equivalent of.

{
if (myReader(1) < 10)  << error here
{
}
LVL 9
###### Who is Participating?

Commented:
If you are trying to compare the value to 10 you need to convert it to integer first since the reader returns string values:
If CType(sqlDR("ttt"), Integer) < 10 Then
0

Commented:
The code you posted is C#. Are you asking for the vb equivalent?
0

Full StackAuthor Commented:
Yes
Dim cIdx As Integer = -1
Dim Other As Integer
Dim NotProvided As Integer

If sqlDR("ttt") < 10 Then
Other += sqlDR("ttt")
ElseIf sqlDR("ttt")  = "" Then
NotProvided += sqlDR("ttt")
Else
cIdx += 1
ReDim Preserve yValues(cIdx)
ReDim Preserve xValues(cIdx)
xValues(cIdx) = sqlDR("ttt")
yValues(cIdx) = sqlDR("AAA")
End If
Loop

If Other > 0 Then
cIdx += 1
ReDim Preserve yValues(cIdx)
ReDim Preserve xValues(cIdx)
xValues(cIdx) = "Other"
yValues(cIdx) = Other
End If

If NotProvided >= 0 Or NotProvided = "0" Then
cIdx += 1
ReDim Preserve yValues(cIdx)
ReDim Preserve xValues(cIdx)
xValues(cIdx) = "Not Provided"
yValues(cIdx) = NotProvided
End If
0

Full StackAuthor Commented:
Even the c# code comes out as error when I use the less than sign with an integer.
0

Commented:
What are you trying to do in this statement?  If sqlDR("ttt") < 10 Then
0

Full StackAuthor Commented:
List<double> yValues = new List<double>();
List<string> xValues = new List<string>();
{{
}

I want to add a if statement in the code above. if myreader(0) < 10 then do something else.
0

Full StackAuthor Commented:
got it thanks
0

Commented:
If myReader(1) < 10 Then
End If
End While
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.