Results 1 to 2 of 2

Thread: Metadata attributes in .NET

  1. #1
    Regina paul is offline Member
    Join Date
    Jun 2009
    Posts
    43
    Rep Power
    0

    Default Metadata attributes in .NET

    I am not getting any solution for my problem and need some help to create my own metadata attributes in .NET? Does somebody have an idea?

  2. #2
    Join Date
    Jun 2009
    Posts
    41
    Rep Power
    0

    Default

    Just derive a class from “System.Attribute” and mark it with the “AttributeUsage” attribute. The script that I have mentioned will definitely help you.

    For example:

    Code:
    [AttributeUsage(AttributeTargets.Class)]
    public class InspiredByAttribute : System.Attribute
    {
    public string InspiredBy; 
    public Inspired By Attribute( string inspiredBy ) 
    {
     InspiredBy = inspiredBy;
     }
     }
    [InspiredBy(".NET FAQ")] class CTest{}
    
     class Capp
     {
          public static void Main()
          {
            object[] atts = typeof(CTest).GetCustomAttributes(true);
            foreach( object att in atts )
            if( att is InspiredByAttribute )
    Console.WriteLine( "Class CTest was inspired by {0}", ((InspiredByAttribute)att).InspiredBy);
    }
    }

Similar Threads

  1. Incapable to edit the metadata in FLAC archive
    By TorresScott in forum Operating System
    Replies: 1
    Last Post: 05-19-2010, 01:50 PM
  2. Protected attributes in a class hierarchy
    By allister fisher in forum Programming
    Replies: 3
    Last Post: 10-21-2009, 12:11 PM
  3. Volume Activation 2.0 Technical Attributes.xls User Manual
    By nalk349 in forum Download User Manual
    Replies: 0
    Last Post: 07-31-2008, 01:07 PM
  4. Remove metadata from pictures
    By techck007 in forum Windows Vista
    Replies: 0
    Last Post: 06-23-2008, 11:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48