User Defined Attributes

Jacob Carlborg doob at me.com
Tue Nov 6 11:43:53 PST 2012


On 2012-11-06 19:42, Max Samukha wrote:

> C# allows custom attributes on function parameters, including the return
> value. Actually, it allows custom meta-data everywhere. See a use case
> here
> http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx.
>
> I believe Java does the same.

Yes it does:

http://docs.oracle.com/javase/1.5.0/docs/guide/language/annotations.html

You need to specify the target tough, like declaration of an annotation:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Test { }

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list