Click here to Skip to main content
15,898,678 members
Home / Discussions / C#
   

C#

 
AnswerRe: how do I binary search a struct array? Pin
Guffa25-Oct-06 12:08
Guffa25-Oct-06 12:08 
GeneralRe: how do I binary search a struct array? Pin
kshet2626-Oct-06 2:33
kshet2626-Oct-06 2:33 
GeneralRe: how do I binary search a struct array? Pin
Guffa26-Oct-06 10:08
Guffa26-Oct-06 10:08 
QuestionInstantiate a HTMLDocument object with the Url or Html stream Pin
Nadia Monalisa25-Oct-06 8:53
Nadia Monalisa25-Oct-06 8:53 
QuestionSafeArray Pin
C++NewBe25-Oct-06 8:49
C++NewBe25-Oct-06 8:49 
AnswerRe: SafeArray Pin
led mike25-Oct-06 10:08
led mike25-Oct-06 10:08 
QuestionAny tool for code clean up ? Pin
Nadia Monalisa25-Oct-06 8:15
Nadia Monalisa25-Oct-06 8:15 
QuestionCompare types in a plugin API Pin
Jost Pedro25-Oct-06 7:09
Jost Pedro25-Oct-06 7:09 
Hi there,

I’m trying to implement a plug in API in a application and I’m having problems in getting the Custom Attribute from an Assembly.

First the custom attribute is something like this:

[global::System.AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]<br />
public class AssemblyPluginAttribute : Attribute<br />
{<br />
     readonly string pluginName;<br />
<br />
     // This is a positional argument.<br />
    public AssemblyPluginAttribute(string PluginName)<br />
     {<br />
         this.pluginName = PluginName;<br />
     }<br />
<br />
     public string PluginName<br />
     {<br />
         get<br />
         {<br />
             return this.pluginName;<br />
         }<br />
      }<br />
}


Than in order to find a reference to this custom attribute I added to the plug-in project the following line.
<br />
  ...<br />
using Enki.UI.ComponentModel;<br />
<br />
[assembly: AssemblyPluginAttribute("TestPlugin")]<br />
<br />
namespace TestPlugin<br />
{<br />
   ...<br />

Now ... to find if its a plug-in type assembly i look through the custom attributes of the assembly in order to find one matching with the one i defined (AssemblyPluginAttribute).

The following line returns null list.

<br />
Type AttType = typeof(Enki.UI.Plugins.AssemblyPluginAttribute);<br />
<br />
object[] obj = assembly.GetCustomAttributes(AttType, true);<br />


and the next one too...

Attribute[] attlist= Attribute.GetCustomAttributes(assembly,AttType);

but if instead of one of this two lines i use the following code

...<br />
  foreach (Attribute att in Attribute.GetCustomAttributes(assembly))<br />
  {<br />
    if (att.GetType().FullName.CompareTo(AttType.FullName)==0)<br />
        return true;<br />
  }<br />
<br />
  ...<br />


it matches the full names!! I’ve tried many other ways to establish a possible comparison but none has the same result. I know, that if i found a way to get the result i desired i should stick to it an go on but I believe that this might lead me to a dead end in the future.
Please, can anyone help me... to "see the light in the end of the tunnel"! Smile | :)

Tanks





Pedro M.
AnswerRe: Compare types in a plugin API Pin
led mike25-Oct-06 8:55
led mike25-Oct-06 8:55 
GeneralRe: Compare types in a plugin API Pin
Jost Pedro26-Oct-06 0:00
Jost Pedro26-Oct-06 0:00 
Questionhow to deploy my app (vs2005) with crystalreport XI ? Pin
hdv21225-Oct-06 7:07
hdv21225-Oct-06 7:07 
AnswerRe: how to deploy my app (vs2005) with crystalreport XI ? Pin
bearfx25-Oct-06 8:33
bearfx25-Oct-06 8:33 
QuestionHow to debug when I'm developing an outlook add-in using COM? [modified] Pin
OctopusThu25-Oct-06 6:42
OctopusThu25-Oct-06 6:42 
QuestionHowTo make a dll, which can be called by VBA Pin
Ariadne25-Oct-06 6:29
Ariadne25-Oct-06 6:29 
AnswerRe: HowTo make a dll, which can be called by VBA Pin
bearfx25-Oct-06 8:35
bearfx25-Oct-06 8:35 
QuestionArray List Pin
iamnew2C#25-Oct-06 6:15
iamnew2C#25-Oct-06 6:15 
QuestionMS Web Browser control Pin
CoolASL25-Oct-06 5:42
CoolASL25-Oct-06 5:42 
AnswerRe: MS Web Browser control Pin
Judah Gabriel Himango25-Oct-06 5:48
sponsorJudah Gabriel Himango25-Oct-06 5:48 
GeneralRe: MS Web Browser control Pin
CoolASL25-Oct-06 6:13
CoolASL25-Oct-06 6:13 
AnswerRe: MS Web Browser control Pin
Martin2325-Oct-06 6:15
Martin2325-Oct-06 6:15 
QuestionLINQ (C# 3.0) Pin
Alvaro Mendez25-Oct-06 5:02
Alvaro Mendez25-Oct-06 5:02 
AnswerRe: LINQ (C# 3.0) Pin
Judah Gabriel Himango25-Oct-06 5:31
sponsorJudah Gabriel Himango25-Oct-06 5:31 
GeneralRe: LINQ (C# 3.0) Pin
Alvaro Mendez25-Oct-06 6:21
Alvaro Mendez25-Oct-06 6:21 
GeneralRe: LINQ (C# 3.0) Pin
Judah Gabriel Himango25-Oct-06 17:06
sponsorJudah Gabriel Himango25-Oct-06 17:06 
QuestionExcel and Windows Services Pin
gantww25-Oct-06 4:50
gantww25-Oct-06 4:50 

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.