Click here to Skip to main content
15,881,787 members
Home / Discussions / C#
   

C#

 
QuestionXNA Curve Class Pin
Mike Ellison9-Aug-07 14:51
Mike Ellison9-Aug-07 14:51 
AnswerRe: XNA Curve Class Pin
Judah Gabriel Himango9-Aug-07 15:35
sponsorJudah Gabriel Himango9-Aug-07 15:35 
GeneralRe: XNA Curve Class Pin
Mike Ellison10-Aug-07 6:16
Mike Ellison10-Aug-07 6:16 
GeneralRe: XNA Curve Class Pin
Judah Gabriel Himango10-Aug-07 6:25
sponsorJudah Gabriel Himango10-Aug-07 6:25 
GeneralRe: XNA Curve Class Pin
Mike Ellison10-Aug-07 6:34
Mike Ellison10-Aug-07 6:34 
GeneralRe: XNA Curve Class Pin
Judah Gabriel Himango10-Aug-07 6:48
sponsorJudah Gabriel Himango10-Aug-07 6:48 
GeneralRe: XNA Curve Class Pin
Mike Ellison10-Aug-07 14:17
Mike Ellison10-Aug-07 14:17 
QuestionHow to resolve this FxCop warning? Pin
Scott Dorman9-Aug-07 12:32
professionalScott Dorman9-Aug-07 12:32 
I asked this question last week, but with the high wheat/chaff ratio it probably got missed...

I've run into an FxCop warning that I'm having a difficult time understanding how to get around it (other than simply supressing the message).

I have a class that implements multiple interfaces. These interfaces are:
C#
public interface IHistoryService
{
   bool Supported { get; }
   Document Document { get; }
}
 
public interface IValidationService
{
   bool Supported { get; }
   ReadOnlyCollection ValidationErrors { get; }
}
Since the interfaces both define bool Supported { get; }, I need to implement them explicitly. It is possible that, given different internal states, the IHistoryService functionality might be supported while the IValidationService functionality isn't (or vice versa).

For the sake of simplicity, here is a much slimmed down version of my implemenation class:
C#
public class DocumentViewer : Form, IHistoryService, IValidationService
{
   bool IHistoryService.Supported
   { 
      get { return true; } 
   }
 
   bool IValidationService.Supported
   {
      get { return true; } 
   }
}
When I run FxCop against this assembly, I get the following warning:
CA1033 : Microsoft.Design : Make 'DocumentViewer' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'IDocumentInformationService.get_DocumentTemplateFullName():String' and is visible to derived classes.
From the description on MSDN, it tells me:
Consider a base type that explicitly implements a public interface method. A type that derives from the base type can only access the inherited interface method through a reference to the current instance (this in C#) that is cast to the interface. If the derived type re-implements (explicitly) the inherited interface method, the base implementation is no longer accessible. The call through the current instance reference will invoke the derived implementation; this results in recursion and an eventual stack overflow.
So...I know I could implement
C#
public bool Supported
{
    get { return true; }
}
which would satisfy the warning. The problem here is that this property doesn't make sense on the DocumentViewer, so it would be completely useless (other than to satisfy the warning).

How would I implement this so it satisfies the warning, or is this really even something to worry about?

-----------------------------
In just two days, tomorrow will be yesterday.

http://geekswithblogs.net/sdorman

AnswerRe: How to resolve this FxCop warning? Pin
Andrew Rissing9-Aug-07 12:58
Andrew Rissing9-Aug-07 12:58 
GeneralRe: How to resolve this FxCop warning? Pin
Scott Dorman9-Aug-07 13:04
professionalScott Dorman9-Aug-07 13:04 
AnswerRe: How to resolve this FxCop warning? Pin
Guffa9-Aug-07 14:01
Guffa9-Aug-07 14:01 
GeneralRe: How to resolve this FxCop warning? Pin
Scott Dorman9-Aug-07 17:16
professionalScott Dorman9-Aug-07 17:16 
AnswerRe: How to resolve this FxCop warning? Pin
Judah Gabriel Himango9-Aug-07 15:31
sponsorJudah Gabriel Himango9-Aug-07 15:31 
GeneralRe: How to resolve this FxCop warning? Pin
Scott Dorman9-Aug-07 17:20
professionalScott Dorman9-Aug-07 17:20 
Questionchanging color of a edited row of a datagrid Pin
Nosnibor9-Aug-07 11:12
Nosnibor9-Aug-07 11:12 
AnswerRe: changing color of a edited row of a datagrid Pin
Nouman Bhatti9-Aug-07 20:06
Nouman Bhatti9-Aug-07 20:06 
AnswerRe: changing color of a edited row of a datagrid Pin
Nouman Bhatti9-Aug-07 20:08
Nouman Bhatti9-Aug-07 20:08 
QuestionDetermine the amount of red in an image Pin
newb2vb9-Aug-07 10:28
newb2vb9-Aug-07 10:28 
AnswerRe: Determine the amount of red in an image Pin
Christian Graus9-Aug-07 11:20
protectorChristian Graus9-Aug-07 11:20 
AnswerRe: Determine the amount of red in an image [modified] Pin
Luc Pattyn9-Aug-07 11:49
sitebuilderLuc Pattyn9-Aug-07 11:49 
AnswerRe: Determine the amount of red in an image Pin
c0ax_lx10-Aug-07 4:29
c0ax_lx10-Aug-07 4:29 
QuestionClipboard copy and a listview Pin
Piet Pelle9-Aug-07 9:31
Piet Pelle9-Aug-07 9:31 
AnswerRe: Clipboard copy and a listview Pin
Judah Gabriel Himango9-Aug-07 9:43
sponsorJudah Gabriel Himango9-Aug-07 9:43 
GeneralRe: Clipboard copy and a listview Pin
Piet Pelle9-Aug-07 9:54
Piet Pelle9-Aug-07 9:54 
GeneralRe: Clipboard copy and a listview Pin
Judah Gabriel Himango9-Aug-07 9:57
sponsorJudah Gabriel Himango9-Aug-07 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.