Created
October 30, 2018 12:10
-
-
Save mythz/a9ded232cbe3f1a6c185219efe30e669 to your computer and use it in GitHub Desktop.
Rename inherited member in Sub class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using System.Runtime.Serialization; | |
using ServiceStack; | |
using ServiceStack.Text; | |
[DataContract] | |
public class Parent | |
{ | |
[DataMember(Name = "parentItem")] | |
public virtual string Item { get; set; } | |
} | |
[DataContract] | |
public class Child : Parent | |
{ | |
[DataMember(Name = "childItem")] | |
public override string Item { get; set; } | |
} | |
var json1 = new Parent { Item = "parent" }.ToJson(); | |
json1.Print(); | |
var json2 = new Child { Item = "child" }.ToJson(); | |
json2.Print(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="ServiceStack.Text" version="5.2.0" targetFramework="net45" /> | |
<package id="ServiceStack.Client" version="5.2.0" targetFramework="net45" /> | |
<package id="ServiceStack.Interfaces" version="5.2.0" targetFramework="net45" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment