Faisal.Map.Object 1.0.2

There is a newer version of this package available.
See the version list below for details.
Install-Package Faisal.Map.Object -Version 1.0.2
dotnet add package Faisal.Map.Object --version 1.0.2
<PackageReference Include="Faisal.Map.Object" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Faisal.Map.Object --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Faisal.Map.Object, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Faisal.Map.Object as a Cake Addin
#addin nuget:?package=Faisal.Map.Object&version=1.0.2

// Install Faisal.Map.Object as a Cake Tool
#tool nuget:?package=Faisal.Map.Object&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Let me start with one scenario. Just imagine we have an object which has lots of public properties and we need to use only some properties of it for the user profile method. For example, we have a class Teacher_Interview and another class named Teacher_College.

Public class Teacher_Interview { Public int UID {get; set;} Public string Name {get; set;} Public string Email {get; set;} Public string Subject {get; set;} }

Public class Teacher_College { Public int TID {get; set;} Public string Name {get; set;} Public string Email {get; set;} }

Here, we have written both the classes. As we can see, we have a Teacher_Interview class that contains its public properties. Now, we need to use the Teacher_college class object and want the same values from the Teacher_Interview class object. For example, we wrote Teacher_Interview object.

Teacher_Interview ti = new Teacher_Interview() { UID = 101 Name = “Faisal Pathan” Email = faisalmpathan@gmail.com Subject = “.NET” } Now, in a normal case, we copy/use the Teacher_Interview object value in Teacher_College like below.

Teacher_College tc = new Teacher_College() { TID = ti.UID, Name = ti.Name, Email = ti.Email } Just think about what happens if we have 40-50 or more than 50 properties. In this case, we have to write the same line 40 to 50 times which is definitely a time-consuming and boring thing. It is also possible to forget to assign some of the properties which will result in an error. So, what is the solution for that? We can use System.reflection namespace and classes. Here, I wrote a generic method, namely “MatchAndMap” which copies the same name properties from Teacher_Interview class object to the Teacher_College class object.

Var records = (Teacher_Interview_class_object).MapProperties<Teacher_College_class_object>();

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 348 2/22/2019
1.0.3 299 2/22/2019
1.0.2 312 2/21/2019

Map method is updated.