Skip to content

Commit 4ebe8d5

Browse files
committed
update readme
1 parent caba453 commit 4ebe8d5

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ SourceReflection aims to provide a more universal solution, offering `AOTable` R
4343
## Installing Reflection
4444

4545
```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
4747
```
4848
```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
5050
```
5151

5252
## Source Reflection
@@ -199,14 +199,52 @@ Assert.IsTrue(type.GetProperty("Field").IsRequired);
199199
[SourceReflection]
200200
public class InitOnlyPropertyTestObject
201201
{
202-
public required int Property { get; init; }
202+
public int Property { get; init; }
203203
}
204204
```
205205
```c#
206206
var type = SourceReflector.GetType(typeof(InitOnlyPropertyTestObject));
207207
Assert.IsTrue(type.GetProperty("Property").IsInitOnly);
208208
```
209209

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+
210248
## Create Instance
211249

212250
The `SourceReflector.CreateInstance` method has almost the same functionality and features as the `System.Activator.CreateInstance` method.

0 commit comments

Comments
 (0)