Skip to content

Commit

Permalink
Update readme and release notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
KeRNeLith committed May 31, 2019
1 parent 97e48cd commit 493cf6f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,32 @@ FieldInfo field = ...;
MyAttribute attribute = field.GetImmediateAttribute<MyAttribute>();
```

### Object wrapper

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.

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.

Following a quick example:

```csharp
MyClass myObject = new MyClass();

ObjectWrapper wrapper = new ObjectWrapper(myObject);

// Properties/Fields
ImmediateField field = wrapper.GetField("_myField");
ImmediateProperty property = wrapper.GetProperty("MyProperty");

// Get
object propertyValue = wrapper.GetPropertyValue("MyProperty");

// Set
wrapper.SetPropertyValue("MyOtherProperty", 42); // myObject.MyOtherProperty = 42
```

Note that the wrapper gives access to the wrapped object, its `Type`, `ImmediateType` and public members.

### Creating typed delegate (Open delegate)

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.
Expand Down
5 changes: 3 additions & 2 deletions src/ImmediateReflection/ImmediateReflection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- Include PDB files in NuGet for Source Link because symbolsource.org does not support portable PDBs -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

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

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

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

Misc:
- Improve library documentation.
Expand Down

0 comments on commit 493cf6f

Please sign in to comment.