I have a Java library I'm considering porting to C#. The Java library makes extensive use of annotations (at both build time and run time.)
I've never used C# attributes, but understand that they are the rough equivalent of Java annotations.
If I proceed with the port using attributes to replace annotations, what do I need to know? W...
How do I create a custom attribute to extend existing Authorize attribute in MVC?
...
Hi, problem:
How do I strip all attributes from HTML tags in a string, except "alt" and "src" using Java?
And further.. how do I get the content from all "src" attributes in the string?
:)
...
The way you seem to declare WCF services is to create an interface in C# or VB, and then tag it with ServiceContractAttribute and it's methods with OperationContractAttribute.
The issue is, I'd like to try creating one from IronRuby or IronPython, which (to my knowledge) don't support attributes.
Is this possible?
...
I have a Method which Takes Int as Input
public void GetMonth(int Month)
{
}
Now when I call this method I want to make sure that Compiler generates and Error Message when someone enters number which does not fall between 1-12.
e.g
obj.GetMonth(14)--Here it should give error and does not compile
Is it possible ?
...
I've seen several classes in the framework with this behavior (a refresh symbol in the watch window, and a warning). Is this controlled by an Attribute? If so, how can I emulate this in my library?
EDIT: Thanks for the info! To clarify, I am developing a framework with properties that must access data from a single thread. Unfortunately...
I have an XML schema and an instance document I get from a customer.
For example the document can be:
<doc>
<carId>12</carId>
</doc>
And it is valid according to the schema.
I would like to annotate this with my attributes:
<doc>
<carId myns:valid="true">12</carId>
</doc>
I would like the annotated document to be va...
Hi,
Last time I asked a similar question but that was about svn related versioning info. Now I am wondering how to query windows "File version" attribute about eg. a dll. I payed attention to wmi and win32file modules as well without success. Thanks U in advance.
D.
...
I'm using a strongly typed DataSet for which manually adding rows will be error prone. I'm providing factory methods to create rows properly. I'd like to guide consumers of my class away from the generated Add*Row methods on the *Table classes.
Adding Obsolete attributes to the generated methods would do the trick. Sadly, they would be...
A Unit-Test should
produce deterministic result
be independent
be valid
...
What other characteristics should a test also have?
...
Duplicate of can a c class inherit attributes from its interface
Using Resharper, I extracted an interface of an existing class. This class has some attributes set on a few members, and Resharper also put these on the interface members.
Can I delete these attributes from the interface?
Attributes on an interface aren't inherited when i...
Hello, all. I seem to forgot the process and how to set a class property to xml element or attribute by setting attribute on the property member. So you can write out the object to xml.
I'm not sure I'm making any sense here but hopefully someone know what I'm talking about and point me to a how-to or tutorial or MSDN document.
Thank
...
I'm trying to find a way to change the serialization behavior of a property.
Lets say I have a situation like this:
[Serializable]
public class Record
{
public DateTime LastUpdated {get; set; }
// other useful properties ...
}
public class EmployeeRecord : Record
{
public string EmployeeName {get; set; }
// other useful ...
For example I want to remove or change below property attributes or add a new one. Is it possible?
[XmlElement("bill_info")]
[XmlIgnore]
public BillInfo BillInfo
{
get { return billInfo; }
set { billInfo = value; }
}
...
Question based on MSDN example: http://msdn.microsoft.com/en-us/library/aa288454(VS.71).aspx
Let's say we have some C# classes with HelpAttribute in standalone desktop application. Is it possible to enumerate all classes with such attribute? Does it make sense to recognize classes this way? Custom attribute would be used to list possibl...
Visual Studio doesn't like on-page anchor tags:
Validation (XHTML 1.0 Transitional):
Attribute 'name' is considered
outdated. A newer construct is
recommended.
I'm using name attributes in this way
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml...
I have a base controller with a HandleErrorAttibute decorating the class declaration like so:
[HandleError(View="Error", Order=1)]
public class BaseController : Controller
If I put [HandleError(View="DifferentError", Order=2)] on a subclassed controller method and an exception occurs, I get the Error.aspx rendered view. I expect t...
Is there a way in Python to determine if an object has some attribute? For example:
>>> a = SomeClass()
>>> a.someProperty = value
>>> a.property
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: SomeClass instance has no attribute 'property'
How can you tell if a has the attribute property befo...
I have read a bit about Design-Time Attributes for Components. There I found an attribute called CategoryAttribute. On that page it says that
The CategoryAttribute class defines the following common categories:
And then lists up a number of common categories. One of them are for example Appearance. I thought, brilliant! Then I can...
Trying to find some verbose reference on the intricacies of Attributes. Any help would be appreciated.
At this point, I'd specifically like to know what time during runtime does an attribute constructor get ran?
If it's over a class
If it's over a property
If it's over a method
Thanks.
...