generics
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| generics [2018/02/10 10:44] – wolfgangriedmann | generics [2018/08/20 04:06] (current) – wolfgangriedmann | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| Generics are a new feature in the .NET framework, and they permit to specify also the type of a parameter for a function. Whenever you see a ''< | Generics are a new feature in the .NET framework, and they permit to specify also the type of a parameter for a function. Whenever you see a ''< | ||
| + | ===== Use of generics ===== | ||
| + | |||
| As sample how to use generics look at the [[collections: | As sample how to use generics look at the [[collections: | ||
| - | < | + | < |
| oList := List< | oList := List< | ||
| Line 9: | Line 11: | ||
| oList:Add( "hi guys" )</ | oList:Add( "hi guys" )</ | ||
| The List class is defined as follows: | The List class is defined as follows: | ||
| - | < | + | < |
| That means that you need to define which datatype the List object should contain. In the sample before it is a string, but it can be any datatype/ | That means that you need to define which datatype the List object should contain. In the sample before it is a string, but it can be any datatype/ | ||
| + | |||
| + | ===== Define a method with generics ===== | ||
| + | |||
| + | ===== Define a class with generics ===== | ||
| + | |||
| + | ===== More informations ===== | ||
| + | |||
| You can also look at this page for a better explanation: | You can also look at this page for a better explanation: | ||
| Line 16: | Line 25: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | Another source of more information about generics can be found in the Pearls section of the X# forums: [[https:// | ||
| Please note that Vulcan.NET could use methods with generic type parameters, but could not let you create them. | Please note that Vulcan.NET could use methods with generic type parameters, but could not let you create them. | ||
generics.1518259460.txt.gz · Last modified: 2018/02/10 10:44 by wolfgangriedmann