Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
Is there a way to make a C# custom attribute raise a message at compile time?

A colleague of mine is using ObsoleteAttribute on not-yet-implemented methods so we get the warning at compile time.

Since a method to be implemented is in the exact opposite place of an obsolete one, however, that bugs me.

I don't see a NotYetImplementedButPleaseBePatientWeVeGotLoadsOfOtherThingsToDoAsWellAttribute in the documentation, so I'm figuring maybe we could create one.

ObsoleteAttribute is sealed, so we can't inherit it. (Yes, I found that out when I tried it. Nice try, me.)

Is there another way to imitate ObsoleteAttribute, but with a more appropriate name?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You cannot achieve exactly the same as [Obsolete], because that is handled directly by the compiler. However, you could write a "Roslyn analyzer" that looks for anything you like, and adds warnings, errors, suggestions, etc, based on your preferences. It could perhaps even (perhaps additionally) try to look for throw new NotImplementedException();. Writing a Roslyn analyzer is not, however, a trivial task.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda