What I have is a form with one fieldset containing several other fieldsets. For each fieldset, the user can check a box next to the legend and expand that fieldset (in theory, at least). I was thinking it would be cool to try using pure CSS for the effect, but I'm getting hung up on how to write the rule based on the two elements positi...
I have tried the following code using the 2.0 framework and I get an attribute back, but when I try this on the compact framework, it always returns an empty array. The MSDN documenation says its supported, am I doing something wrong?
Test x = new Test();
FieldInfo field_info = x.GetType().GetField("ArrayShorts");
object[] custom...
I'm restating this problem to summarise what I've already found:
I have a test TypeConverter, (MyConverter), that for a ConvertToString will output "Converted To String", no matter what the input.
To ensure this is picked up by GetConverter for Int32, I add the following line:
(1) Dim tcp As TypeDescriptionProvider = TypeDescriptor.Ad...
Hi.
I would like to know whether the usage of Attributes in .Net, specifically C#, is expensive, and why or why not?
I am asking about C# specifically, unless there is no difference between the different .Net languages (because the base class libraries are the same?).
All the newer .Net technologies make extensive use of attributes, ...
This probably isn't possible, but it's annoying enough to try...
For convenience sake I'd like to be able to select "Go to definition" on a property or method on a variable defined as an interface and have Visual Studio go to the concrete implementation instead of the interface. Is there an attribute or something that I can use to instr...
I have a set of properties and need to provide a default values for them. Sure I can do the following in getter:
public string MyProp {
get {
if(!string.IsNulOrEmpty(_myProp))
return _myProp;
else
return "Default";
}
But I`d like it to look li...
I'm having headaches trying to make this work: I have a <a> element with a background-image defined with style="" attribute and I have put a function to append inside the <a> element a <span> handling different background-positions for :hover effects with opacity changes. The thing is, I need to get the same style attribute from each <a>...
If I have an object with an array as an attribute, what is the easiest way to access it?
$obj->odp = array("ftw", "pwn", array("cool" => 1337));
//access "ftw"
$obj->odp->0
//access 1337
$obj->odp->2->cool
This doesn't seem to work. Is there something I'm doing wrong, or do I have to first assign it to a variable?
$arr = $obj->odp;...
(Written in Python shell)
>>> o = object()
>>> o.test = 1
Traceback (most recent call last):
File "<pyshell#45>", line 1, in <module>
o.test = 1
AttributeError: 'object' object has no attribute 'test'
>>> class test1:
pass
>>> t = test1()
>>> t.test
Traceback (most recent call last):
File "<pyshell#50>", line 1, in <modul...
Hi.
I have a WCF service. I need to implement IServiceBehavior in my class that implements ServiceContract. I have some some attributes on that class that specify service behavior. I wanted to ask if after implementing IServiceBehavior behaviors specified in attributes still apply.
Basically does
[ServiceBehavior(InstanceContextMode =...
I have some classes that, for one reason or another, cannot be or need not be unit tested. I'd like to exclude these classes from my coverage metrics so that I can get a better feel for the coverage on the classes I actually care about. Right now I have to exclude the results after the fact. What I would like to do is use an attribute...
Hello,
I get an xml from the 3rd party and I need to deserialize it into C# object. This xml may contain attributes with value of integer type or empty value: attr=”11” or attr=””. I want to deserialize this attribute value into the property with type of nullable integer. But XmlSerializer does not support deserialization into nullable ...
I'm writing some library code, and classes that use that code are required to have two attributes specified (one custom attribute and one from .NET).
It's a bit of a hassle to document this requirement and copy-and-paste both of those attributes onto every class that uses my library, so I thought it might be better to have my custom att...
Two questions about attributes:
When are attribute classes instantiated? When the type is first accessed, or at the start of execution?
From within the attribute class, can I find out for which type the attribute was instantiated?
The idea is that I want to make a list of all the classes in my assembly that have my attribute applied ...
Hi there
I am trying to determine the type of a property which an attribute relates to, from within the attributes constructor. More specificity I am looking for the class which contains the property.
my current constructor looks like this:
public IndexedCategoryAttribute(Type DefiningClass, String HeaderText, int Index)
{
...
I know the 'nofollow' means to Search Engines "Don't follow this link" (or at least, don't give SEO juice to that link), but what does the "me" mean?
I often see it paired up with "nofollow".
What is it used for? Where should it be used? What are the advantages?
Thanks
...
I have a bunch of custom attributes in my .NET application and I would like to require the user fills out certain properties within the attribute at runtime. Is this possible?
Ideally I'd like Visual Studio to produce an error when they try to build which states that since they used a particular attribute they must complete X, Y, Z prop...
If i declare
[Flags]
public enum MyColor
{
Red = 1;
Green = 2;
Blue = 4;
White = 8;
Magenta = 16;
... (etc)
}
Is there a way to determine/set the number of Bytes that this enum takes up? Also, what byte order would it end up in? (e.g. do i have to do a HostToNetwork() to properly send it over the wire?) Also,...
Is there a way to create an XSD that allows an attribute from a different namespace, but only if it's qualified? An example of an XML file that would be valid according to the schema is
<d:document dx:size="a5"
xmlns:d="http://example.com/documents"
xmlns:dx="http://example.com/document-extensions"/>
The schema should enfor...
Is there a way to generate a hash-like ID in for objects in python that is solely based on the objects' attribute values? For example,
class test:
def __init__(self, name):
self.name = name
obj1 = test('a')
obj2 = test('a')
hash1 = magicHash(obj1)
hash2 = magicHash(obj2)
What I'm looking for is something where hash1 ==...