0

在 C# 中,如何在实现接口时填写所需的值。

这是我的界面代码:

public interface IGridViewWithImageAndTextItem
{
    string type { get; set;}
    string thumbnailDisplayText { get; set; }
    string thumbnailImageWebAddress { get; set; }
}

在我的一个类中实现这个接口时,添加了以下代码:

#region IGridViewWithImageAndTextItem implementation
public string type {
    get {
        throw new NotImplementedException ();
    }
    set {
        throw new NotImplementedException ();
    }
}
public string thumbnailDisplayText {
    get {
        throw new NotImplementedException ();
    }
    set {
        throw new NotImplementedException ();
    }
}
public string thumbnailImageWebAddress {
    get {
        throw new NotImplementedException ();
    }
    set {
        throw new NotImplementedException ();
    }
}
#endregion

现在我已经实现了接口,我用什么值代替以下代码:

throw new NotImplementedException ()

我是否将代码更改为简单{ get; set; }值,还是需要做其他事情?

提前致谢

4

1 回答 1

0

是的,您可以将它们替换为

{ get; set; }

所以你的代码将是:

public string type { get; set;}
public string thumbnailDisplayText { get; set; }
public string thumbnailImageWebAddress { get; set; }
于 2014-06-23T07:42:47.193 回答