可以使用自动实现属性来创建这三个属性,然后定义访问器来实现属性的访问:

public string m_dtfxPath { get; set; }
public string m_xmlPath { get; set; }
public string m_dvfxPath { get; set; }

public string GetDtfxPath()
{
    return m_dtfxPath;
}

public void SetDtfxPath(string value)
{
    m_dtfxPath = value;
}

public string GetXmlPath()
{
    return m_xmlPath;
}

public void SetXmlPath(string value)
{
    m_xmlPath = value;
}

public string GetDvfxPath()
{
    return m_dvfxPath;
}

public void SetDvfxPath(string value)
{
    m_dvfxPath = value;
}

使用自动实现属性可以省略访问器的定义,但是需要注意的是自动实现属性只能提供基本的属性访问,不能实现更复杂的逻辑。如果需要实现自定义的逻辑,需要使用访问器来实现

m_dtfxPathm_xmlPath m_dvfxPath 在c#中创建这3个属性并创建访问器

原文地址: https://www.cveoy.top/t/topic/dnsn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录