To use Dapper you need anonymous types. How can you define these in X#? In C# the syntax is e.g. new {x = ‘test’}
Thanks
Hansjörg
How to define anonymous types?
-
- Posts: 139
- Joined: Mon Jul 25, 2016 3:58 pm
- Location: Italy
Re: How to define anonymous types?
A look for "anonymous" into X# help provides:
The syntax for an anonymous class is :
VAR o := CLASS { Name := "test", Value := "something" }
Is that, what you need?
The syntax for an anonymous class is :
VAR o := CLASS { Name := "test", Value := "something" }
Is that, what you need?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
-
- Posts: 139
- Joined: Mon Jul 25, 2016 3:58 pm
- Location: Italy
Re: How to define anonymous types?
Thanks. Yes this is what I need
Re: How to define anonymous types?
HansJoerg,
If you're filling an anonymous type from another object then you don't need to include the names
This will use the names of the properties as name of the properties in the anonymous type.
Robert
If you're filling an anonymous type from another object then you don't need to include the names
Code: Select all
CLASS {Customer.ID, Customer.Name, Customer.DateOfBirth}
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Re: How to define anonymous types?
The syntax in X# is close but not exact:
X#: CLASS {x := "test"}
C#: new {x = ‘test’}
X#: CLASS {x := "test"}
C#: new {x = ‘test’}