Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. [SOLVED] Representing Metadata

[SOLVED] Representing Metadata

Scheduled Pinned Locked Moved Algorithms
csharpquestiondiscussion
3 Posts 2 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    I'd like to have non C# metadata about some of my classes stored with those classes. I tried creating static virtual methods that would return the metadata, but alas, C# doesn't support static virtual methods. So it got me thinking...What's the best way to store metadata about classes inside those classes so that you can retrieve it from an instance or from a static method? Or is there another better way to store metadata about the classes? SOLUTION: I'll just create virtual instance methods. But I'd still like to hear your thoughts on the matter. SECOND SOLUTION: Due to Gerry's suggestion, I am now using Attributes for this purpose. It's working out better than instance methods would have.

    The difficult we do right away... ...the impossible takes slightly longer.

    L 1 Reply Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I'd like to have non C# metadata about some of my classes stored with those classes. I tried creating static virtual methods that would return the metadata, but alas, C# doesn't support static virtual methods. So it got me thinking...What's the best way to store metadata about classes inside those classes so that you can retrieve it from an instance or from a static method? Or is there another better way to store metadata about the classes? SOLUTION: I'll just create virtual instance methods. But I'd still like to hear your thoughts on the matter. SECOND SOLUTION: Due to Gerry's suggestion, I am now using Attributes for this purpose. It's working out better than instance methods would have.

      The difficult we do right away... ...the impossible takes slightly longer.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I was going to suggest "attributes" ... or is that "C# metadata"? ... which you don't want. [Extending Metadata Using Attributes - .NET | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/standard/attributes/)

      "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

      Richard Andrew x64R 1 Reply Last reply
      0
      • L Lost User

        I was going to suggest "attributes" ... or is that "C# metadata"? ... which you don't want. [Extending Metadata Using Attributes - .NET | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/standard/attributes/)

        "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

        Richard Andrew x64R Offline
        Richard Andrew x64R Offline
        Richard Andrew x64
        wrote on last edited by
        #3

        I need to store information that one cannot get from .net reflection. That's all I meant by non C#. But I think that attributes might be what I'm looking for. Thanks for the idea!

        The difficult we do right away... ...the impossible takes slightly longer.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups