Extend TypeMapper
pull/1/head
unknown 3 years ago
parent 516407064b
commit 844c35f70a

@ -65,7 +65,7 @@ namespace ZeroLevel
return false;
}
private static bool IsEmptyLocate<T>(T[] array, T[] candidate)
private static bool IsEmptyLocate<T>(this T[] array, T[] candidate)
{
return array == null
|| candidate == null
@ -74,7 +74,7 @@ namespace ZeroLevel
|| candidate.Length > array.Length;
}
public static IEnumerable<T> GetRow<T>(T[,] array, int row)
public static IEnumerable<T> GetRow<T>(this T[,] array, int row)
{
for (int i = 0; i < array.GetLength(1); i++)
{
@ -82,6 +82,14 @@ namespace ZeroLevel
}
}
public static IEnumerable<T> GetColumn<T>(this T[,] array, int column)
{
for (int i = 0; i < array.GetLength(0); i++)
{
yield return array[i, column];
}
}
public static bool Equals(byte[] first, byte[] second)
{
if (null == first && null == second)

@ -1,4 +1,5 @@
using System;
using System.Reflection;
namespace ZeroLevel.Services.ObjectMapping
{
@ -13,5 +14,6 @@ namespace ZeroLevel.Services.ObjectMapping
Type ClrType { get; }
Action<object, object> Setter { get; }
Func<object, object> Getter { get; }
MemberInfo Original { get; }
}
}

@ -12,8 +12,9 @@ namespace ZeroLevel.Services.ObjectMapping
public bool IsField { get; set; }
public string Name { get; set; }
public Type ClrType { get; set; }
public Action<object, object> Setter { get; set; }
public Func<object, object> Getter { get; set; }
public Action<object, object> Setter { get; private set; }
public Func<object, object> Getter { get; private set; }
public MemberInfo Original { get; private set; }
#endregion Properties
@ -57,7 +58,8 @@ namespace ZeroLevel.Services.ObjectMapping
{
var field = new MapMemberInfo(TypeGetterSetterBuilder.BuildSetter(fieldInfo), TypeGetterSetterBuilder.BuildGetter(fieldInfo))
{
Name = fieldInfo.Name
Name = fieldInfo.Name,
Original = fieldInfo
};
field.IsField = true;
var type = fieldInfo.FieldType;
@ -69,7 +71,8 @@ namespace ZeroLevel.Services.ObjectMapping
{
var field = new MapMemberInfo(TypeGetterSetterBuilder.BuildSetter(propertyInfo), TypeGetterSetterBuilder.BuildGetter(propertyInfo))
{
Name = propertyInfo.Name
Name = propertyInfo.Name,
Original = propertyInfo
};
field.IsField = false;
var type = propertyInfo.PropertyType;

@ -6,16 +6,16 @@
</Description>
<Authors>ogoun</Authors>
<Company>ogoun</Company>
<AssemblyVersion>3.3.5.3</AssemblyVersion>
<PackageReleaseNotes>Collection lazy deserialization</PackageReleaseNotes>
<AssemblyVersion>3.3.5.5</AssemblyVersion>
<PackageReleaseNotes>Update TypeMapper</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/ogoun/Zero/wiki</PackageProjectUrl>
<Copyright>Copyright Ogoun 2021</Copyright>
<PackageLicenseUrl></PackageLicenseUrl>
<PackageIconUrl></PackageIconUrl>
<RepositoryUrl>https://github.com/ogoun/Zero</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<Version>3.3.5.3</Version>
<FileVersion>3.3.5.3</FileVersion>
<Version>3.3.5.5</Version>
<FileVersion>3.3.5.5</FileVersion>
<Platforms>AnyCPU;x64;x86</Platforms>
<PackageIcon>zero.png</PackageIcon>
</PropertyGroup>

Loading…
Cancel
Save

Powered by TurnKey Linux.