Interface NotImplementedExceptions

120 Views Asked by At

In C#, how do I fill out the required values when implementing an interface.

Here is my interface code:

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

When implementing this interface into a class of mine the following code is added:

#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

Now that I have implemented the interface, what values do I substitute for the following code occurrences:

throw new NotImplementedException ()

Do I change the code to be simple { get; set; } values, or does something else need to be done?

Thanks in advance

1

There are 1 best solutions below

1
On BEST ANSWER

yes you can replace them by

{ get; set; }

so your code will be:

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