Applied 1.2.0.6

Extension methods for object-object or dictionary-object or datatable-object mapping,
single item mapping use [ item.Apply(()=>new { .. }); ],multiple array items mapping use [ items.Apply(a=>new { .. }); ].

Install-Package Applied -Version 1.2.0.6
dotnet add package Applied --version 1.2.0.6
<PackageReference Include="Applied" Version="1.2.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Applied --version 1.2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

public enum UserEnum
{
None,
User
}
[Serializable]
public class User
{
public int UserID { get; set; }
public string Name { get; set; }
public DateTime? Time { get; set; }
public UserEnum Enum { get; set; }
}
[Serializable]
public class UserViewModel
{
public int UserID { get; set; }
public string Name { get; set; }
public DateTime? Time { get; set; }
public UserEnum Enum { get; set; }
}

User[] users = new User[]
{
new User() { UserID = 1, Name = "Sam " },
new User() { UserID = 2, Name = "John " }
};

users.Apply(a => new { Time = DateTime.Now, Enum = UserEnum.User });
users.Trim();

UserViewModel[] vm1 = users.ToDataEnumerable<User, UserViewModel>().ToArray();
DataTable dt1 = users.ToDataTable();
Dictionary<string, object>[] ds1 = users.ToDictionaries().ToArray();

UserViewModel[] vm2 = dt1.ToDataEnumerable<UserViewModel>().ToArray();
UserViewModel[] vm3 = ds1.ToDataEnumerable<UserViewModel>().ToArray();

DataTable dt2 = vm1.ToDataTable();
DataTable dt3 = ds1.ToDataTable();

Dictionary<string, object>[] ds2 = vm1.ToDictionaries().ToArray();
Dictionary<string, object>[] ds3 = dt1.ToDictionaries().ToArray();

public enum UserEnum
{
None,
User
}
[Serializable]
public class User
{
public int UserID { get; set; }
public string Name { get; set; }
public DateTime? Time { get; set; }
public UserEnum Enum { get; set; }
}
[Serializable]
public class UserViewModel
{
public int UserID { get; set; }
public string Name { get; set; }
public DateTime? Time { get; set; }
public UserEnum Enum { get; set; }
}

User[] users = new User[]
{
new User() { UserID = 1, Name = "Sam " },
new User() { UserID = 2, Name = "John " }
};

users.Apply(a => new { Time = DateTime.Now, Enum = UserEnum.User });
users.Trim();

UserViewModel[] vm1 = users.ToDataEnumerable<User, UserViewModel>().ToArray();
DataTable dt1 = users.ToDataTable();
Dictionary<string, object>[] ds1 = users.ToDictionaries().ToArray();

UserViewModel[] vm2 = dt1.ToDataEnumerable<UserViewModel>().ToArray();
UserViewModel[] vm3 = ds1.ToDataEnumerable<UserViewModel>().ToArray();

DataTable dt2 = vm1.ToDataTable();
DataTable dt3 = ds1.ToDataTable();

Dictionary<string, object>[] ds2 = vm1.ToDictionaries().ToArray();
Dictionary<string, object>[] ds3 = dt1.ToDictionaries().ToArray();

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0.6 94 2/14/2020
1.0.1 110 9/20/2019
1.0.0.8 659 4/28/2018
1.0.0.6 590 6/1/2017