返回对象类时如何忽略某些显示的属性?

问题描述 投票:0回答:0

我在

C#
有这门课:

public class PlayerProfile : BaseDataModel
{
    public String id { get; set; }
    public String AccountType { get; set; }
    public String UserEmail { get; set; }
    public String Username { get; set; }
    public String Country { get; set; }
    public byte[] PasswordHash { get; set; }
    public byte[] PasswordSalt { get; set; }
    public String Passphrase { get; set; }
    public Wallet Wallet { get; set; }
    public List<String> Titles { get; set; }
}

当我在我拥有的一个端点上检索完整的

PasswordHash
类时,我想忽略
PasswordSalt
PlayerProfile

我怎样才能实现这种行为?它只会用于可视化。我之前使用过一个属性(我不记得它是哪个),它从对象中完全删除了这些属性并且无法初始化它们(这不是我想要的行为)。

c# class properties visualization endpoint
© www.soinside.com 2019 - 2024. All rights reserved.