Click here to Skip to main content
13,863,642 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 10 May 2011
Licenced CPOL

A simple attribute to store licensing information and credits

, 10 May 2011
Rate this:
Please Sign up or sign in to vote.
A few fields to store general information on the provided code
using System;
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
public class AttributionAttribute : System.Attribute
    String _author;
    String _authorLink;
    String _contributionTitle;
    String _contributionLink;
    public AttributionAttribute()
    public String Author
        get { return this._author; }
        set { this._author = value; }
    public String AuthorLink
        get { return this._authorLink; }
        set { this._authorLink = value; }
    public String ContributionTitle
        get { return this._contributionTitle; }
        set { this._contributionTitle = value; }
    public String ContributionLink
        get { return this._contributionLink; }
        set { this._contributionLink = value; }

This makes it easy to give credit to the author, without having to keep a list of what's referenced and whatsnot.
[assembly: Attribution
    Author = "Jani Giannoudis",
    AuthorLink = "",
    ContributionTitle = "User Settings Applied",
    ContributionLink = ""

Giving credit in a generic DataGridView is as easy as fetching all attributes from the current executing assembly and all it's references and summing them;
foreach (AttributionAttribute aa in attribs)
  int newRowIdx = dataGridView1.RowCount;
  dataGridView1[0, newRowIdx].Value = aa.Author;
  dataGridView1[0, newRowIdx].ToolTipText = aa.AuthorLink;
  dataGridView1[1, newRowIdx].Value = aa.ContributionTitle;
  dataGridView1[1, newRowIdx].ToolTipText = aa.ContributionLink;

Enjoy :)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Eddy Vluggen
Software Developer Currently none.
Netherlands Netherlands
I'm a Delphi-convert, mostly into WinForms and C#. My first article is from 2001, extending the Delphi-debugger, which is still visible on the WayBackMachine[^] and even available in Russian[^] Smile | :)

You may also be interested in...

Comments and Discussions

QuestionGreat! Pin
Sascha Lefèvre20-Oct-17 13:46
professionalSascha Lefèvre20-Oct-17 13:46 
GeneralCool! ;) Pin
Jani Giannoudis10-May-11 20:23
memberJani Giannoudis10-May-11 20:23 
GeneralRe: Thanks :) Pin
Eddy Vluggen11-May-11 12:03
mveEddy Vluggen11-May-11 12:03 
GeneralSehr Gut! :) Pin
DrABELL10-May-11 11:39
professionalDrABELL10-May-11 11:39 
GeneralRe: Vielen Dank :) Pin
Eddy Vluggen11-May-11 12:03
mveEddy Vluggen11-May-11 12:03 

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.190214.1 | Last Updated 10 May 2011
Article Copyright 2011 by Eddy Vluggen
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid