第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在同一方法中訪問調(diào)用其類的方法的對象?

如何在同一方法中訪問調(diào)用其類的方法的對象?

C#
守著星空守著你 2021-05-15 13:28:24
    public class Container : XmlElementGenerator{    public string projectcode { get; set; }    public string projectname { get; set; }    public string projectleader { get; set; }    public string barcode { get; set; }    public string sampleartid { get; set; }    public string sampledescription { get; set; }    public string remark { get; set; }    public DateTime samplingdate { get; set; }    public int samplenumber { get; set; }    public XmlElement GenerateXMLElement(XmlDocument xmlDocument)    {        Type containerGenerator = typeof(Container);        XmlElement container = ElementChildrenGenerator(xmlDocument, "container");        foreach (PropertyInfo prop in containerGenerator.GetProperties())        {            container.AppendChild(ElementChildrenGenerator(xmlDocument, prop.Name, prop.GetValue(this).ToString()));        }        return container;    }}此處出現(xiàn)錯誤prop.GetValue(this)-“ System.NullReferenceException:對象引用未設(shè)置為對象的實例”。為什么我不能使用“ this”來訪問對象?我不想再添加一個參數(shù)。請幫助
查看完整描述

2 回答

?
波斯汪

TA貢獻1811條經(jīng)驗 獲得超4個贊

找到了解決方案-我只是沒有檢查輸入到屬性的空值。做了檢查,它起作用了。


查看完整回答
反對 回復 2021-05-21
  • 2 回答
  • 0 關(guān)注
  • 155 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號