Method | Description | |
---|---|---|
CreateCustomAttribute ( |
Method | Description | |
---|---|---|
ConvertValue ( object obj, |
Attributes can only accept simple types, so we return null for null, if the value is passed as string we call to string (should help with converting), otherwise, we use the value as is (enums, integer, etc).
|
|
GetArgValue ( |
||
GetConstructorAndArgs ( |
||
GetDefaultValueFor ( |
||
GetFieldValues ( |
||
GetPropertyValues ( |
||
InitializeConstructorArgs ( |
Here we try to match a constructor argument to its value. Since we can't get the values from the assembly, we use some heuristics to get it. a/ we first try to match all the properties on the attributes by name (case insensitive) to the argument b/ if we fail we try to match them by property type, with some smarts about convertions (i,e: can use Guid for string).
|
|
ReplaceIfBetterMatch ( |
We have the following rules here. Try to find a matching type, failing that, if the parameter is string, get the first property (under the assumption that we can convert it.
|
public static CreateCustomAttribute ( |
||
attribute | ||
return |