Class FieldCopierBuilder<ParameterType>
Used to build a copy function that will copy the fields from one object to another. Add the fields you want to copy via the AddField(FieldInfo) function, and call Finish() to create the function
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public sealed class FieldCopierBuilder<ParameterType>
Type Parameters
Name | Description |
---|---|
ParameterType |
Constructors
| Edit this page View SourceFieldCopierBuilder()
Declaration
public FieldCopierBuilder()
FieldCopierBuilder(Type)
Declaration
public FieldCopierBuilder(Type typeToCopy)
Parameters
Type | Name | Description |
---|---|---|
Type | typeToCopy |
Methods
| Edit this page View SourceAddField(FieldInfo)
Adds a field to be copied
Declaration
public void AddField(FieldInfo field)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | field | The field to copy |
AddField(string, BindingFlags)
Adds a field to be copied
Declaration
public void AddField(string fieldName, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
Parameters
Type | Name | Description |
---|---|---|
string | fieldName | The name of the field to be added |
BindingFlags | flags | The binding flags to find the field |
AddRange(IEnumerable<FieldInfo>)
Adds a range of fields to be copied
Declaration
public void AddRange(IEnumerable<FieldInfo> fields)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<FieldInfo> | fields |
Finish()
Creates the finished method that copies the fields from one type to another. The first parameter is the object to copy the data to, and the second parameter is the object to copy the data from
Declaration
public FieldCopierBuilder<ParameterType>.ShallowCopyDelegate Finish()
Returns
Type | Description |
---|---|
FieldCopierBuilder<ParameterType>.ShallowCopyDelegate |
FinishFunc()
Creates the finished method that copies the fields from one type to another. The first parameter is the object to copy the data to, and the second parameter is the object to copy the data from
Declaration
public Action<ParameterType, ParameterType> FinishFunc()
Returns
Type | Description |
---|---|
Action<ParameterType, ParameterType> |