0

I would like to know if there is a variant data type in Delphi prism.

I am converting a Delphi win32 application for Delphi Prism .NET environment.

ThN
  • 3,235
  • 3
  • 57
  • 115
  • 4
    `object` can represent "all types", but it won't allow invoking methods will-nilly. `dynamic` (in .NET4) can also represent "all types", but it will allow invoking methods willy-nilly. Ideally though, a correct strong type is chosen/used, however. (I can't say I missing "variant" data types...) –  Jun 21 '12 at 19:09
  • @pst, I would have posted that as an answer :-) – Bridge Jun 21 '12 at 19:09
  • I don't think there's a specific type that replaces it, but `object` should work for `variant` – MilkyWayJoe Jun 21 '12 at 19:10

2 Answers2

5

The closest thing is Object as all types derive from it. This is not a great solution though.

With .NET 4.0 the dynamic keyword was introduced that may be closer to what you are looking for.

A direct analogue does not exist.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
1

I think variant data types in C++/COM are roughly equivalent to the object type in C#. The Wikipedia article confirms this: http://en.wikipedia.org/wiki/Variant_type in the fourth paragraph

noisecapella
  • 814
  • 7
  • 17