-6

I have this line in C#:

newline_pos = Array.FindIndex(buffer, offset, bytes, x => (x == NEWLINE));

Really have question in this part x => (x == NEWLINE).

Please help me.

jww
  • 97,681
  • 90
  • 411
  • 885
Jearca
  • 33
  • 1
  • 8

1 Answers1

2

Go here: http://converter.telerik.com and convert the C# to VB.Net:

C#:

x => (x == NEWLINE)

VB.Net:

(Function(x) x = NEWLINE)
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • @Jearca Using the converter will solve your other question **[here](http://stackoverflow.com/questions/27643644/converting-function-t-to-c-sharp-to-vb-net)**. Dont forget to mark correct answers (the holo tickbox under the voting buttons. – Jeremy Thompson Dec 26 '14 at 04:06
  • thanks is the correct lambda expression the problem is x is a byte and NEWLINE is a char, so i have a error i need to know if that expression is correct?? `Function(x) x.CompareTo(NEWLINE)` – Jearca Dec 26 '14 at 04:07
  • VB.Net uses *implicit* casting, it doesn't require *Explicit* casting. So in VB.Net you dont worry about converting the byte to char to test for equality. Only in C# do you have to *explicitly* cast types. – Jeremy Thompson Dec 26 '14 at 04:08
  • ok, but i have a error and i cant compile, for that i need know if i can use `Function(x) x.CompareTo(NEWLINE)` – Jearca Dec 26 '14 at 04:10
  • Copy the entire function (not just the line with the `Array.FindIndex`) into http://converter.telerik.com and it will solve the conversion for you :) Its a good way to learn either C# or VB.Net when you only know one of the languages and wish to learn the other. – Jeremy Thompson Dec 26 '14 at 04:11