@@ -43,10 +43,10 @@ SourceReflection aims to provide a more universal solution, offering `AOTable` R
43
43
## Installing Reflection
44
44
45
45
``` powershell
46
- Install-Package SourceGeneration.Reflection -Version 1.0.0-beta2.250412 .0
46
+ Install-Package SourceGeneration.Reflection -Version 1.0.0-beta2.250415 .0
47
47
```
48
48
``` powershell
49
- dotnet add package SourceGeneration.Reflection --version 1.0.0-beta2.250412 .0
49
+ dotnet add package SourceGeneration.Reflection --version 1.0.0-beta2.250415 .0
50
50
```
51
51
52
52
## Source Reflection
@@ -199,14 +199,52 @@ Assert.IsTrue(type.GetProperty("Field").IsRequired);
199
199
[SourceReflection ]
200
200
public class InitOnlyPropertyTestObject
201
201
{
202
- public required int Property { get ; init ; }
202
+ public int Property { get ; init ; }
203
203
}
204
204
```
205
205
``` c#
206
206
var type = SourceReflector .GetType (typeof (InitOnlyPropertyTestObject ));
207
207
Assert .IsTrue (type .GetProperty (" Property" ).IsInitOnly );
208
208
```
209
209
210
+ ## GenericEnumerableType Property
211
+ ``` c#
212
+ [SourceReflection ]
213
+ public class EnumerablePropertyTestObject
214
+ {
215
+ public IEnumerable <string > Enumerable { get ; init ; }
216
+ public List <string > List { get ; init ; }
217
+ public CustomList CustomList { get ; init ; }
218
+ }
219
+
220
+ public class CustomList : IList <int > { }
221
+ ```
222
+ ``` c#
223
+ var type = SourceReflector .GetType (typeof (EnumerablePropertyTestObject ));
224
+ Assert .IsTrue (type .GetProperty (" Enumerable" ).IsGenericEnumerableType );
225
+ Assert .IsTrue (type .GetProperty (" List" ).IsGenericEnumerableType );
226
+ Assert .IsTrue (type .GetProperty (" CustomList" ).IsGenericEnumerableType );
227
+ ```
228
+
229
+ ## GenericDictionaryType Property
230
+ ``` c#
231
+ [SourceReflection ]
232
+ public class DictionaryPropertyTestObject
233
+ {
234
+ public IDictionary <string ,string > Dictionary { get ; init ; }
235
+ public SortedDictionary <string ,string > SortedDictionary { get ; init ; }
236
+ public CustomDictionary CustomDictionary { get ; init ; }
237
+ }
238
+
239
+ public class CustomDictionary : IDictionary <int ,object > { }
240
+ ```
241
+ ``` c#
242
+ var type = SourceReflector .GetType (typeof (DictionaryPropertyTestObject ));
243
+ Assert .IsTrue (type .GetProperty (" Dictionary" ).IsGenericDictionaryType );
244
+ Assert .IsTrue (type .GetProperty (" SortedDictionary" ).IsGenericDictionaryType );
245
+ Assert .IsTrue (type .GetProperty (" CustomDictionary" ).IsGenericDictionaryType );
246
+ ```
247
+
210
248
## Create Instance
211
249
212
250
The ` SourceReflector.CreateInstance ` method has almost the same functionality and features as the ` System.Activator.CreateInstance ` method.
0 commit comments