Skip to content

Adapt to existing object not work when have readonly property #984

@ahdung

Description

@ahdung

Please help.

void Main()
{
	var a1=new Foo(){Id=3,Name="aa"};
	var a2=new Foo(){Id=3};
	a1.Adapt(a2);
	a2.Name.Dump(); // will got null
}

class Foo(){
	public int Id {get;set;}
	public string Name{get;set;}
	public string Prop {get;} //when have setter, no problem
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions