Complete list of .NET conversion statements

Does anyone have a complete list of conversion operators for VB / C # and how do they differ?

I still know ...

  • value as type [C #]
  • TryCast (value, type) [VB]
  • Convert.ToXxx (value) [any]
  • (type) value [C #]
  • CType (value, type) [VB]
  • DirectCast (value, type) [VB]
  • CXxx (value) [VB]
  • CTypeDynamic [any]
  • implicit conversions when using the Strict Off [VB] parameter
  • implicit conversions when using dynamic [C #]
  • value of type [F #]
  • :> [F #]
  • :? > [F #]

But, of course, just having a list is not the same as knowing the subtle differences between them.

+3
source share
1 answer

F # # /, .

# F #? ( : )

, , .

( ,

type value

F #, , , ,

int 'a'

, int - F #, . . Docs ; T T, .)

F #:

  • stringPrintfFormat ( typeafe printf)
  • upcasts /, , . f(dog) person.Pet <- dog, Animal. , . let controls : Control list = [button; form; window]
  • - , , . new Thread(fun() -> ()), F # ThreadStart.
  • ref to byref , ref, . a out.

, - F # .

+4

Source: https://habr.com/ru/post/1754293/


All Articles