473,667 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Attributes as Interface implementaion, good or bad?

Has anybody ever used custom attributes to implement a custom interface for a
user defined type?

thx
-jsh
Jun 22 '06 #1
2 1104
Has anybody ever used custom attributes to implement a custom interface for a
user defined type?


An attribute can't implement interfaces for types it's applied to, if
that's what you mean.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 22 '06 #2
Hi Mattias Sjögren,
Thanks for the response.
I say you Attributes do implement Interfaces, you have to define an
Attribute type to support it. However, is that consider 'breaking' or
'stretching' the contract, when using Reflection, when the udt wants other
types to use itself?

thx
-jsh
Jun 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2682
by: Francis Avila | last post by:
A little annoyed one day that I couldn't use the statefulness of generators as "resumable functions", I came across Hettinger's PEP 288 (http://www.python.org/peps/pep-0288.html, still listed as open, even though it's at least a year old and Guido doesn't seem very hot on the idea). I'm not too sure of its ideas on raising exceptions in generators from outside (although it looks like it might be convenient in some cases), but being able...
5
2396
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and relevant announcements. If you're interested, drop me a note. But if for some reason you think that this discussion is fine here at the c.l.py, please let me know. ** LONG POST AHEAD **
26
448
by: codymanix | last post by:
Last night I had several thought about RAII and want to discuss a bit. Why doesn't CSharp support destructors in structs? Wouldn't that make RAII possible like in C++? When the struct goes out of scope, the dtor could be immediately be called (no GC needed). For that, you don't have to declare the whole File class as a struct (which would be not good for performance when File has a lot of data-members). Instead creating a thin wrapper...
1
8490
by: Microsoft | last post by:
Hello there, I have following situation , how can I solve this puzzle in C#. I have interface called IVendor with some custom attributes applied to it interface IVendor {
5
5324
by: harishashim | last post by:
I have gone through necessary step and have been able to use a .Net libraries (created using C#) in VB6. It run good untill I try to use certain function in the library that is using Int64 type as parameter. VB6 give the following error Compile Error: Function or interface marked as restricted, or the function use an automation type not supported in Visual Basic.
1
2562
by: adesoky | last post by:
I have a class that inherit from two interfaces, each interface has one method but the signatures of the two interfaces' methods are identical. How I can implement each method in the class identifying that each implementaion is related to the method of one interface. Like Interface 1 has mymethod, and Interface 2 has mymethod also with the same signature , how class can override the two methods identifying there interface
4
1201
by: csharpula csharp | last post by:
Hello, I would like to know if it is possible to inforce specific members implementation just as methods inforcment of methods implementaion in Interface? Thank u! *** Sent via Developersdex http://www.developersdex.com ***
7
10305
by: Mukesh | last post by:
Hi, Consider a situation where a class (Say C1) is implementing two interfaces (I1, I2). Both the interface contains a method (M1) with the same signature. class C1:I1, I2 { //implementation of M1 only once } I wanna understand why we need only one implementation of M1. It
1
1692
by: Steve K. | last post by:
I added a property to an interface like this: <code> public interface ISimpleAddress { string CarrierFax{ get; set; } } </code>
0
8458
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8565
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2779
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.