本文整理汇总了C#中PropertyAttributes类的典型用法代码示例。如果您正苦于以下问题:C# PropertyAttributes类的具体用法?C# PropertyAttributes怎么用?C# PropertyAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyAttributes类属于命名空间,在下文中一共展示了PropertyAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static VirtualPropertyInfo Create(string name,
Type declaringType,
Type reflectedType,
Type propertyType,
PropertyAttributes attributes,
bool readable,
bool writable)
{
return
internalizedCache.GetOrAdd(
GetUniqueKey(declaringType, reflectedType, propertyType, readable, writable, name, attributes),
key =>
{
VirtualMethodInfo getterBaseDefinition = null;
VirtualPropertyInfo baseProperty = null;
if (declaringType != reflectedType)
{
baseProperty = Create(name, declaringType, declaringType, propertyType, attributes, readable,
writable);
getterBaseDefinition = baseProperty.getMethod;
}
const MethodAttributes methodAttributes =
MethodAttributes.NewSlot | MethodAttributes.SpecialName |
MethodAttributes.HideBySig
| MethodAttributes.Virtual | MethodAttributes.Public;
var getter = new VirtualMethodInfo("get_" + name, declaringType, reflectedType, methodAttributes,
baseDefinition : getterBaseDefinition);
var prop = new VirtualPropertyInfo(name, declaringType, reflectedType, propertyType, getter,
null, attributes, baseProperty);
return prop;
});
}
示例2: PropertyInfoMirror
public PropertyInfoMirror (TypeMirror parent, long id, string name, MethodMirror get_method, MethodMirror set_method, PropertyAttributes attrs) : base (parent.VirtualMachine, id) {
this.parent = parent;
this.name = name;
this.attrs = attrs;
this.get_method = get_method;
this.set_method = set_method;
}
示例3: DefineProperty
public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes)
{
var pb = _typeBuilder.DefineProperty(name, attributes, returnType, parameterTypes);
_members.Add(pb);
_paramsByMember.Add(pb, parameterTypes);
return pb;
}
示例4: PropertyEmitter
// private ParameterInfo[] indexParameters;
public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, String name, PropertyAttributes attributes,
Type propertyType)
{
this.parentTypeEmitter = parentTypeEmitter;
builder = parentTypeEmitter.TypeBuilder.DefineProperty(name, attributes, propertyType, new Type[0]);
}
示例5: MarshalAccessorProperty
public MarshalAccessorProperty(int index, JsObject getter, JsObject setter, PropertyAttributes attributes)
{
Index = index;
Getter = getter;
Setter = setter;
Attributes = attributes;
}
示例6: PropertyBuilder
// Constructs a PropertyBuilder.
//
internal PropertyBuilder(
ModuleBuilder mod, // the module containing this PropertyBuilder
String name, // property name
SignatureHelper sig, // property signature descriptor info
PropertyAttributes attr, // property attribute such as DefaultProperty, Bindable, DisplayBind, etc
Type returnType, // return type of the property.
PropertyToken prToken, // the metadata token for this property
TypeBuilder containingType) // the containing type
{
if (name == null)
throw new ArgumentNullException("name");
if (name.Length == 0)
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
if (name[0] == '\0')
throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name");
Contract.EndContractBlock();
m_name = name;
m_moduleBuilder = mod;
m_signature = sig;
m_attributes = attr;
m_returnType = returnType;
m_prToken = prToken;
m_tkProperty = prToken.Token;
m_containingType = containingType;
}
示例7: VirtualPropertyInfo
internal VirtualPropertyInfo(string name,
Type declaringType,
Type reflectedType,
Type propertyType,
VirtualMethodInfo getMethod,
VirtualMethodInfo setMethod,
PropertyAttributes attributes,
VirtualPropertyInfo baseDefinition)
{
if (declaringType == null)
throw new ArgumentNullException(nameof(declaringType));
if (reflectedType == null)
throw new ArgumentNullException(nameof(reflectedType));
if (propertyType == null)
throw new ArgumentNullException(nameof(propertyType));
if (name == null)
throw new ArgumentNullException(nameof(name));
DeclaringType = declaringType;
ReflectedType = reflectedType;
PropertyType = propertyType;
this.getMethod = getMethod;
this.setMethod = setMethod;
Name = name;
Attributes = attributes;
BaseDefinition = baseDefinition ?? this;
MetadataToken = VirtualMemberMetadataTokenAllocator.AllocateToken();
}
示例8: PropertyEmitter
// private ParameterInfo[] indexParameters;
public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, string name, PropertyAttributes attributes,
Type propertyType, Type[] arguments)
{
this.parentTypeEmitter = parentTypeEmitter;
// DYNPROXY-73 - AmbiguousMatchException for properties
// This is a workaround for a framework limitation in CLR 2.0
// This limitation was removed in CLR 2.0 SP1, but we don't want to
// tie ourselves to that version. This perform the lookup for the new overload
// dynamically, so we have a nice fallback on vanilla CLR 2.0
if (TypeBuilderMethods.DefineProperty == null || true) // TODO
{
DefineProperty_Clr2_0 oldDefineProperty = parentTypeEmitter.TypeBuilder.DefineProperty;
builder = oldDefineProperty(name, attributes, propertyType, arguments);
}
else
{
var newDefinedProperty = (DefineProperty_Clr_2_0_SP1)
Delegate.CreateDelegate(typeof(DefineProperty_Clr_2_0_SP1),
parentTypeEmitter.TypeBuilder,
TypeBuilderMethods.DefineProperty);
builder = newDefinedProperty(
name, attributes, CallingConventions.HasThis, propertyType,
null, null, arguments, null, null);
}
}
示例9: PropertyBuilder
internal PropertyBuilder(TypeBuilder typeBuilder, string name, PropertyAttributes attributes, PropertySignature sig, bool patchCallingConvention)
{
this.typeBuilder = typeBuilder;
this.name = name;
this.attributes = attributes;
this.sig = sig;
this.patchCallingConvention = patchCallingConvention;
}
示例10: DefineProperty
public void DefineProperty(object index, object value, PropertyAttributes attributes)
{
DefineProperty(
_global.ResolveIdentifier(JsValue.ToString(index)),
value,
attributes
);
}
示例11: MetadataPropertyInfo
internal MetadataPropertyInfo (IMetadataImport importer, int propertyToken, MetadataType declaringType)
{
m_importer = importer;
m_propertyToken = propertyToken;
m_declaringType = declaringType;
int mdTypeDef;
int pchProperty;
int pdwPropFlags;
IntPtr ppvSig;
int pbSig;
int pdwCPlusTypeFlag;
IntPtr ppDefaultValue;
int pcchDefaultValue;
int rmdOtherMethod;
int pcOtherMethod;
m_importer.GetPropertyProps (
m_propertyToken,
out mdTypeDef,
null,
0,
out pchProperty,
out pdwPropFlags,
out ppvSig,
out pbSig,
out pdwCPlusTypeFlag,
out ppDefaultValue,
out pcchDefaultValue,
out m_pmdSetter,
out m_pmdGetter,
out rmdOtherMethod,
0,
out pcOtherMethod);
StringBuilder szProperty = new StringBuilder (pchProperty);
m_importer.GetPropertyProps (
m_propertyToken,
out mdTypeDef,
szProperty,
pchProperty,
out pchProperty,
out pdwPropFlags,
out ppvSig,
out pbSig,
out pdwCPlusTypeFlag,
out ppDefaultValue,
out pcchDefaultValue,
out m_pmdSetter,
out m_pmdGetter,
out rmdOtherMethod,
0,
out pcOtherMethod);
m_propAttributes = (PropertyAttributes) pdwPropFlags;
m_name = szProperty.ToString ();
MetadataHelperFunctions.GetCustomAttribute (importer, propertyToken, typeof (System.Diagnostics.DebuggerBrowsableAttribute));
}
示例12: PropertyEmitter
public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, string name, PropertyAttributes attributes,
Type propertyType, Type[] arguments)
{
this.parentTypeEmitter = parentTypeEmitter;
builder = parentTypeEmitter.TypeBuilder.DefineProperty(
name, attributes, CallingConventions.HasThis, propertyType,
null, null, arguments, null, null);
}
示例13: Add
public JsSchema Add(int index, PropertyAttributes attributes, ref object[] values, object value)
{
// The entry shouldn't be in our schema yet.
Debug.Assert(GetOffset(index) < 0);
// Get or create the new schema.
JsSchema schema = null;
// Check whether we already have a transformation.
if (_transformations != null)
schema = _transformations.GetValue(MakeIndex(index, attributes));
int newOffset;
// Build the new schema if we don't have it yet and add it to the
// list of transformations.
if (schema == null)
{
schema = new JsSchema(this);
// Apply the mutation to the new schema. We get a free entry or,
// if there isn't any, increase the array size.
var freeList = schema._freeList;
if (freeList == null)
{
schema.GrowFreeEntries();
freeList = schema._freeList;
}
schema._freeList = freeList.Next;
newOffset = freeList.Index;
schema._node = new Node(true, index, attributes, newOffset, _node);
if (_transformations == null)
_transformations = new SchemaTransformationHashSet(InitialTransformationsSize);
_transformations.Add(MakeIndex(index, attributes), schema);
}
else
{
newOffset = schema.GetOffset(index);
// The attributes of this property of the new schema should
// be the same as what we're adding.
Debug.Assert(schema.GetAttributes(index) == attributes);
}
// Apply the transformation to the values array.
if (_arraySize != schema._arraySize)
Array.Resize(ref values, schema._arraySize);
values[newOffset] = value;
return schema;
}
示例14: DefineProperty
public void DefineProperty(int index, JsFunction @delegate, int argumentCount, PropertyAttributes attributes)
{
EnsurePropertyStore();
PropertyStore.DefineProperty(
index,
Global.CreateFunction(Global.GetIdentifier(index), @delegate, argumentCount),
attributes
);
}
示例15: DefineAccessor
public void DefineAccessor(int index, JsObject getter, JsObject setter, PropertyAttributes attributes)
{
EnsurePropertyStore();
PropertyStore.DefineProperty(
index,
new PropertyAccessor(getter, setter),
attributes
);
}