public interface INote{
public long NodeId { get; set; }
public string NoteName { get; set; }
}
public class LongNote : INote {
public long NodeId { get; set; }
public string NoteName { get; set; }
public string barcodeID {get;set;}
public string profileURL {get;set;}
}
public class Memo: INote {
public long NodeId { get; set; }
public string NoteName { get; set; }
public string memoURL {get;set;}
public string memoUniqueID {get;set;}
}
Memo resource = QueryVariant(new NoteItem(), "memo"); //doesnt work
private async Task<INote> QueryVariant(NoteItem item, string type) {
INote note = type switch {
"memo" => new Memo { /*initialize properties here*/ };
// replicate for the other types
_ => // throw some exception here
};
// initialize common properties in note here, i.e:
note.id = item.Id.ToString():
note.noteName = item.name;
// etc
return note;
}
public interface INote{
public long NodeId { get; set; }
public string NoteName { get; set; }
}
public class LongNote : INote {
public long NodeId { get; set; }
public string NoteName { get; set; }
public string barcodeID {get;set;}
public string profileURL {get;set;}
}
public class Memo: INote {
public long NodeId { get; set; }
public string NoteName { get; set; }
public string memoURL {get;set;}
public string memoUniqueID {get;set;}
}
Memo resource = QueryVariant(new NoteItem(), "memo"); //doesnt work
private async Task<INote> QueryVariant(NoteItem item, string type) {
INote note = type switch {
"memo" => new Memo { /*initialize properties here*/ };
// replicate for the other types
_ => // throw some exception here
};
// initialize common properties in note here, i.e:
note.id = item.Id.ToString():
note.noteName = item.name;
// etc
return note;
}