Skip to content

Commit 493cf6f

Browse files
committed
Update readme and release notes.
1 parent 97e48cd commit 493cf6f

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,32 @@ FieldInfo field = ...;
152152
MyAttribute attribute = field.GetImmediateAttribute<MyAttribute>();
153153
```
154154

155+
### Object wrapper
156+
157+
By using `ImmediateType` API you can manipulate get/set on object via "open" methods, meaning you can specify the instance on which applying the method.
158+
159+
ImmediateReflection also provides an `ObjectWrapper` that does the same job as `ImmediateType` but on a "closed" way. It means that get/set will be applied only on the wrapped instance.
160+
161+
Following a quick example:
162+
163+
```csharp
164+
MyClass myObject = new MyClass();
165+
166+
ObjectWrapper wrapper = new ObjectWrapper(myObject);
167+
168+
// Properties/Fields
169+
ImmediateField field = wrapper.GetField("_myField");
170+
ImmediateProperty property = wrapper.GetProperty("MyProperty");
171+
172+
// Get
173+
object propertyValue = wrapper.GetPropertyValue("MyProperty");
174+
175+
// Set
176+
wrapper.SetPropertyValue("MyOtherProperty", 42); // myObject.MyOtherProperty = 42
177+
```
178+
179+
Note that the wrapper gives access to the wrapped object, its `Type`, `ImmediateType` and public members.
180+
155181
### Creating typed delegate (Open delegate)
156182

157183
ImmediateReflection provides an API like standard one for `Type`, `FieldInfo` and `PropertyInfo`, this means get/set for properties use object both for target and parameter/return type.

src/ImmediateReflection/ImmediateReflection.csproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<!-- Include PDB files in NuGet for Source Link because symbolsource.org does not support portable PDBs -->
2020
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
2121

22-
<Copyright>Copyright © 2018</Copyright>
22+
<Copyright>Copyright © 2019</Copyright>
2323
<Description>.NET library that aims to provide a faster usage of C# reflection features.
2424
Especially the usage of constructors, members accessors (get/set) and attributes.
2525

@@ -47,15 +47,16 @@ Fixes:
4747
Changes:
4848
- Default flags taken into account when getting an ImmediateType are Public | Instance | Static
4949
- Get rid of cache system references replaced by a simpler internal caching system.
50+
- Extend caching support to target .NET Framework 4.0.
5051

5152
New:
5253
- Add the possibility to call the default constructor of type in a faster way (with or without throw).
5354
- ImmediateType provides access to every members via Members/GetMembers()/indexed member APIs.
5455
- ImmediateType, ImmediateField and ImmediateProperty provide a faster access to attributes.
5556
- Extensions to retrieve Immediate Reflection types from standard types.
5657
- Extensions to retrieve attributes from standard MemberInfo.
57-
- Extend caching support to target .NET Framework 4.0.
5858
- Provide helpers to easily create strongly typed delegate to get/set properties.
59+
- Add an object wrapper that allows to get/set value on a specific object instance.
5960

6061
Misc:
6162
- Improve library documentation.

0 commit comments

Comments
 (0)