本文整理汇总了C#中PropertyAttributes类的典型用法代码示例。如果您正苦于以下问题:C# PropertyAttributes类的具体用法?C# PropertyAttributes怎么用?C# PropertyAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyAttributes类属于命名空间,在下文中一共展示了PropertyAttributes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
});
}
开发者ID:Pomona,项目名称:Pomona,代码行数:32,代码来源:VirtualPropertyInfo.cs
示例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;
}
开发者ID:shana,项目名称:Mono.Debugger.Soft,代码行数:7,代码来源:PropertyInfoMirror.cs
示例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;
}
开发者ID:davidvmckay,项目名称:ProxyFoo,代码行数:7,代码来源:FooTypeFromTypeBuilder.cs
示例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]);
}
开发者ID:havard,项目名称:strongbind,代码行数:8,代码来源:PropertyEmitter.cs
示例5: MarshalAccessorProperty
public MarshalAccessorProperty(int index, JsObject getter, JsObject setter, PropertyAttributes attributes)
{
Index = index;
Getter = getter;
Setter = setter;
Attributes = attributes;
}
开发者ID:pvginkel,项目名称:Jint2,代码行数:7,代码来源:MarshalAccessorProperty.cs
示例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;
}
开发者ID:afrog33k,项目名称:csnative,代码行数:28,代码来源:PropertyBuilder.cs
示例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();
}
开发者ID:Pomona,项目名称:Pomona,代码行数:27,代码来源:VirtualPropertyInfo.cs
示例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);
}
}
开发者ID:BiBongNet,项目名称:JustMockLite,代码行数:29,代码来源:PropertyEmitter.cs
示例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;
}
开发者ID:ngraziano,项目名称:mono,代码行数:8,代码来源:PropertyBuilder.cs
示例10: DefineProperty
public void DefineProperty(object index, object value, PropertyAttributes attributes)
{
DefineProperty(
_global.ResolveIdentifier(JsValue.ToString(index)),
value,
attributes
);
}
开发者ID:pvginkel,项目名称:Jint2,代码行数:8,代码来源:DictionaryPropertyStore.cs
示例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));
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:58,代码来源:MetadataPropertyInfo.cs
示例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);
}
开发者ID:jeremymeng,项目名称:Core,代码行数:9,代码来源:PropertyEmitter.cs
示例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;
}
开发者ID:pvginkel,项目名称:Jint2,代码行数:57,代码来源:JsSchema.cs
示例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
);
}
开发者ID:pvginkel,项目名称:Jint2,代码行数:9,代码来源:JsObject.Properties.cs
示例15: DefineAccessor
public void DefineAccessor(int index, JsObject getter, JsObject setter, PropertyAttributes attributes)
{
EnsurePropertyStore();
PropertyStore.DefineProperty(
index,
new PropertyAccessor(getter, setter),
attributes
);
}
开发者ID:pvginkel,项目名称:Jint2,代码行数:9,代码来源:JsObject.Properties.cs
示例16: DefineProperty
public void DefineProperty(PropertyAttributes attributes, PropertyAttributes expected)
{
TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public);
type.DefineProperty("TestProperty", attributes, typeof(int), null, null, new Type[] { typeof(int) }, null, null);
Type createdType = type.CreateTypeInfo().AsType();
PropertyInfo createdProperty = createdType.GetProperty("TestProperty", BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Assert.Equal(typeof(int), createdProperty.PropertyType);
Assert.Equal(expected, createdProperty.Attributes);
}
开发者ID:Corillian,项目名称:corefx,代码行数:12,代码来源:TypeBuilderDefineProperty.cs
示例17: PropertyBuilder
#pragma warning restore 169, 414
internal PropertyBuilder (TypeBuilder tb, string name, PropertyAttributes attributes, Type returnType, Type[] returnModReq, Type[] returnModOpt, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt) {
this.name = name;
this.attrs = attributes;
this.type = returnType;
this.returnModReq = returnModReq;
this.returnModOpt = returnModOpt;
this.paramModReq = paramModReq;
this.paramModOpt = paramModOpt;
if (parameterTypes != null) {
this.parameters = new Type [parameterTypes.Length];
System.Array.Copy (parameterTypes, this.parameters, this.parameters.Length);
}
typeb = tb;
table_idx = tb.get_next_table_index (this, 0x17, true);
}
开发者ID:runefs,项目名称:Marvin,代码行数:17,代码来源:PropertyBuilder.cs
示例18: DefaultPropertyBuilder
/// <summary>
/// Constructor
/// </summary>
/// <param name="typeBuilder">Type builder</param>
/// <param name="name">Name of the property</param>
/// <param name="attributes">Attributes for the property (public, private, etc.)</param>
/// <param name="getMethodAttributes">Get method attributes</param>
/// <param name="setMethodAttributes">Set method attributes</param>
/// <param name="propertyType">Property type for the property</param>
/// <param name="parameters">Parameter types for the property</param>
public DefaultPropertyBuilder(TypeBuilder typeBuilder, string name,
PropertyAttributes attributes, MethodAttributes getMethodAttributes,
MethodAttributes setMethodAttributes,
Type propertyType, IEnumerable<Type> parameters)
{
if (typeBuilder == null)
throw new ArgumentNullException("typeBuilder");
if (string.IsNullOrEmpty(name))
throw new ArgumentNullException("name");
Name = name;
Type = typeBuilder;
Attributes = attributes;
GetMethodAttributes = getMethodAttributes;
SetMethodAttributes = setMethodAttributes;
DataType = propertyType;
Parameters = new List<ParameterBuilder>();
if (parameters != null)
{
int x = 1;
foreach (var parameter in parameters)
{
Parameters.Add(new ParameterBuilder(parameter, x));
++x;
}
}
Field = new FieldBuilder(Type, "_" + name + "field", propertyType, FieldAttributes.Private);
Builder = Type.Builder.DefineProperty(name, attributes, propertyType,
(parameters != null && parameters.Count() > 0)
? parameters.ToArray()
: System.Type.EmptyTypes);
GetMethod = new MethodBuilder(Type, "get_" + name, getMethodAttributes, parameters, propertyType);
GetMethod.Generator.Emit(OpCodes.Ldarg_0);
GetMethod.Generator.Emit(OpCodes.Ldfld, Field.Builder);
GetMethod.Generator.Emit(OpCodes.Ret);
var setParameters = new List<Type>();
if (parameters != null)
{
setParameters.AddRange(parameters);
}
setParameters.Add(propertyType);
SetMethod = new MethodBuilder(Type, "set_" + name, setMethodAttributes, setParameters, typeof (void));
SetMethod.Generator.Emit(OpCodes.Ldarg_0);
SetMethod.Generator.Emit(OpCodes.Ldarg_1);
SetMethod.Generator.Emit(OpCodes.Stfld, Field.Builder);
SetMethod.Generator.Emit(OpCodes.Ret);
Builder.SetGetMethod(GetMethod.Builder);
Builder.SetSetMethod(SetMethod.Builder);
}
开发者ID:OxPatient,项目名称:Rule-Engine,代码行数:58,代码来源:DefaultPropertyBuilder.cs
示例19: DefineProperty
public void DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes, string expectedName, PropertyAttributes expectedPropertyAttributes)
{
TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public);
PropertyBuilder property = type.DefineProperty(name, attributes, returnType, parameterTypes);
Assert.Equal(name, property.Name);
Assert.Equal(attributes, property.Attributes);
Assert.Equal(returnType, property.PropertyType);
Type createdType = type.CreateTypeInfo().AsType();
Assert.Equal(type.AsType().GetProperties(Helpers.AllFlags), createdType.GetProperties(Helpers.AllFlags));
PropertyInfo createdProperty = createdType.GetProperty(expectedName, Helpers.AllFlags);
Assert.Equal(expectedName, createdProperty.Name);
Assert.Equal(expectedPropertyAttributes, createdProperty.Attributes);
Assert.Equal(returnType ?? typeof(void), createdProperty.PropertyType);
}
开发者ID:dotnet,项目名称:corefx,代码行数:16,代码来源:TypeBuilderDefineProperty.cs
示例20: PropertyDescriptor
/// <summary>
/// Creates a new PropertyDescriptor instance.
/// </summary>
/// <param name="value"> The initial value for the property. </param>
/// <param name="attributes"> The property attributes. </param>
public PropertyDescriptor(object value, PropertyAttributes attributes)
{
this.attributes = attributes;
this.value = value;
// If the property is an accessor property, the state of the writable flag is dependant
// whether the setter function exists.
if (this.value is PropertyAccessorValue)
{
this.attributes |= PropertyAttributes.IsAccessorProperty;
if (this.Setter != null)
this.attributes |= PropertyAttributes.Writable;
else
this.attributes &= ~PropertyAttributes.Writable;
}
}
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:21,代码来源:PropertyDescriptor.cs
注:本文中的PropertyAttributes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论