attributes

Can I decorate advanced PowerShell functions with my own custom attributes?

For example: function TestThis() { [MySpecialCustomAttribute] [CmdletBinding()] Param(...) Process{...} } ...

Removing an inherited Attribute in .net

I got a ASP.NET MVC controller like this [Authorize] public class ObjectController : Controller { public ObjectController(IDataService dataService) { DataService = dataService; } public IDataService DataService { get;set;} } The Authorize attribute is defined as "Inherited=true" in the framework. So when i...

CustomAttributes are not being returned from as expected.

I have something that looks like the following: [CoolnessFactor] interface IThing {} class Tester { static void TestSomeInterfaceStuff<T>() { var attributes = from attribute in typeof(T).GetCustomAttributes(typeof(T), true) where attributes == typeof(CoolnessFactorAttribu...

How to detect which assemblies require the Partially Trusted Callers Attribute?

I have downloaded a web project from CodePlex and am getting the following error in Application_Start: System.Security.SecurityException: That assembly does not allow partially trusted callers. This project references several other assemblies from other open source projects. My theory is that one of these do not have the AllowP...

How to use C#-like attributes in C++

I'm considering the use of C++ for a personal project. I would like to make it platform independent (no Mono please, since some platforms don't yet support it), and that's why I considered C++. I have one doubt, however. I've grown quite fond of C#'s attributes, and I would like to know if I can use something similar in C++. Also, is i...

Jquery switching between several images on click

Hi, I'm trying to use jquery to switch between three images once you click on the image. Upon clicking on the third image, it switches it back to the first picture. Is there a way to adapt the following to switch between more than two pictures, and for it to allow more than it switching once? $(document).ready(function() { $("#clic...

(.net) DefaultMemberAttribute - what does it do?

Hello. I've already read the MSDN article about it. It seems internally it is the way c# sets which is the function that is going to work as indexer(am I right?). Now, I've seen the following example: [DefaultMemberAttribute("Main")] public class Program { public static void Main() { ... } } Now, I don't get it what i...

Are Method Attributes Inherited in C#?

Hi, Are attributes applied to an abstract method in a base class applied to the overridden versions in the child classes? I hope the question is clear enough without an example. ...

parsing unknown attributes of elements within an xml file using jquery

Is it possible to get both the attribute name and the value of an element? Basically i want to get the name and the values of all attributes of a single element, in order to write them into a Javascript Object like this: obj { key: "value", another_key: "another_value", } Thx for any response ...

how to get the attr with jquery?

<div class="item"> <p><img src="images/photos_sample1.jpg" border="0" rel="images/google_map.jpg"></p> <p>Dining Area</p> </div> <div class="item"> <p><img src="images/photos_sample2.jpg" border="0" rel="images/sample_photo.jpg"></p> <p>Pool Area</p> </div> I have this html code, and I want to get the rel ...

Get information about the decorated member by an attribute in C#

I need to know if there's any way (or another distinct approach) to an attribute knows something about what is being decorated for him. For example: class Cat { public Cat() { } [MyAttribute] public House House { get; set; } } Inside MyAttribute I must do some preprocessing with the house object... class MyAttribute : At...

openid attribute exchange

i trying around with JanRain openid, i'm already add some required fields like email, nickname etc.. and some optional fields but openid provider dont send back to me any information but user's openid url. I'm trying on localhost. ...

Is there a way to directly link requirements to code units? Is it a stupid idea to even try?

Say we've got requirements for all the functionality we want to build. Each requirement is listed in a Word doc with an associated ID. For instance, Requirement 123 is "each refund, if processed the same business day as the last payment, should be processed as a cancellation and will incur no refund processing fee". What I'd like is for...

Is it safe to use the Attributes collection to store extra data?

Is it safe to use the attributes collection of a web control to store extra data? e.g. DropDownList ddl = new DropDownList(); ddl.Attributes.Add("ExtraData", "SomeData"); ...

(.net) How to check if a given variable is defined with an attribute

Hello. I'd like to know if my textBox1 variable has the ABCAttribute. How can I check this? ...

(.net) Kind of design question

Hello. My typical application has a couple of textboxes, checkbuttons, radiobuttons, and so. I always want to load the settings the user used the last time when the program starts, and also want to save the settings as the users clicks "Save settings" or closes the application. When the user attempts to save the settings, I'll have to c...

C# attribute text from resource file?

Hi, I have an attribute and i want to load text to the attribute from a resource file. [IntegerValidation(1, 70, ErrorMessage = Data.Messages.Speed)] private int i_Speed; But i keep getting "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type" It works pe...

c# Hide a property in datagridview with datasource

I think there must be an attribute to hide a public property from the datagridview. But I can't find it. ...

How to use Join with NHibernate.Mapping.Attributes?

I am trying to join two tables to map to a single entity using NHibernate.Mapping.Attributes. It works when there is only one property in the joined table. However, when there are additional properties they get mapped to the primary table instead of the joined table. [Class(Table = "primarytable")] public class Entity { [Id(0, Name ...

Passing Attributes on DataContracts in WCF

Hello, I have a a datacontract which has important attributes on. For example, in the following code: [DataMember] [Description("My Description")] public string Name { get; set; } I want the Description attribute to be auto generated on the client proxy. Is there any solution, or workarounds besides massive duplication? Many thanks...