本文整理汇总了C#中System.Property类的典型用法代码示例。如果您正苦于以下问题:C# Property类的具体用法?C# Property怎么用?C# Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于System命名空间,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Spec
public Spec(Property[] props)
{
foreach (Property prop in props)
{
spec.Add(prop);
}
}
示例2: GetArgumentStringFor
public string GetArgumentStringFor(Property property)
{
return RawArgumentString
.Replace("#entity.Name#", property.Entity.Name)
.Replace("#property.Name#", property.Name)
.Replace("#property.Type#", property.Type);
}
示例3: establish_context
public override void establish_context()
{
property = ReflectionHelper.GetAccessor(GetPropertyExpression());
target = new PropertyEntity();
sut = new Property<PropertyEntity, string>(property, "expected");
}
示例4: ApplyPropertyTemplate
protected virtual void ApplyPropertyTemplate(Property prop)
{
bool isReadOnly = false;
bool isList = false;
if (prop is ValueTypeProperty)
{
var vtp = (ValueTypeProperty)prop;
isList = vtp.IsList;
isReadOnly = vtp.IsCalculated;
}
else if (prop is CompoundObjectProperty)
{
isList = ((CompoundObjectProperty)prop).IsList;
}
else if (prop is ObjectReferenceProperty)
{
isList = ((ObjectReferenceProperty)prop).IsList();
}
else if (prop is CalculatedObjectReferenceProperty)
{
isReadOnly = true;
}
if (isList)
{
Properties.SimplePropertyListTemplate.Call(Host, ctx, prop);
}
else
{
Properties.SimplePropertyTemplate.Call(Host, ctx, prop, isReadOnly);
}
}
示例5: VisitProperty
public override bool VisitProperty(Property decl)
{
if(!AlreadyVisited(decl) && decl.ExplicitInterfaceImpl == null)
CheckDuplicate(decl);
return false;
}
示例6: Can_search_with_filters
public void Can_search_with_filters()
{
Property property = new Property { Id = Guid.NewGuid(), Name = "Property Name", BedroomCount = 3 };
Catalog catalog = new Catalog() { Id = Guid.NewGuid(), Type = "Waterfront", PropertyId = property.Id };
using(var store = NewDocumentStore())
using(var _session = store.OpenSession())
{
_session.Store(property);
_session.Store(catalog);
_session.SaveChanges();
var catalogs = _session.Advanced.DocumentQuery<Catalog>().WhereEquals("Type", "Waterfront").Select(c => c.PropertyId);
var properties = _session.Advanced.DocumentQuery<Property>();
properties.OpenSubclause();
var first = true;
foreach (var guid in catalogs)
{
if (first == false)
properties.OrElse();
properties.WhereEquals("__document_id", guid);
first = false;
}
properties.CloseSubclause();
var refinedProperties = properties.AndAlso().WhereGreaterThanOrEqual("BedroomCount", "2").Select(p => p.Id);
Assert.NotEqual(0, refinedProperties.Count());
}
}
示例7: AttachEditorComponents
public static void AttachEditorComponents(Entity entity, string name, Property<Entity.Handle> target)
{
entity.Add(name, target);
if (entity.EditorSelected != null)
{
Transform transform = entity.Get<Transform>("Transform");
LineDrawer connectionLines = new LineDrawer { Serialize = false };
connectionLines.Add(new Binding<bool>(connectionLines.Enabled, entity.EditorSelected));
connectionLines.Add(new NotifyBinding(delegate()
{
connectionLines.Lines.Clear();
Entity targetEntity = target.Value.Target;
if (targetEntity != null)
{
Transform targetTransform = targetEntity.Get<Transform>("Transform");
if (targetTransform != null)
{
connectionLines.Lines.Add
(
new LineDrawer.Line
{
A = new Microsoft.Xna.Framework.Graphics.VertexPositionColor(transform.Position, connectionLineColor),
B = new Microsoft.Xna.Framework.Graphics.VertexPositionColor(targetTransform.Position, connectionLineColor)
}
);
}
}
}, transform.Position, target, entity.EditorSelected));
entity.Add(connectionLines);
}
}
示例8: TestSelectionViewModel
private TestSelectionViewModel()
{
_sourceControlBrowser = Property.New(this, p => p.SourceControlTestBrowser, OnPropertyChanged);
_fileSystemBrowser = Property.New(this, p => p.FileSystemTestBrowser, OnPropertyChanged);
_manualEntry = Property.New(this, p => p.ManualEntry, OnPropertyChanged);
_selectedTestCase = Property.New(this, p => p.SelectedTestCase, OnPropertyChanged);
}
示例9: ModelMslEntityTypeMappingScalarProperty
public ModelMslEntityTypeMappingScalarProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Property prop, string parentName)
: base(_host)
{
this.ctx = ctx;
this.prop = prop;
this.parentName = parentName;
}
示例10: Configure
protected virtual PropertyControlInfo Configure(Property property)
{
var info = PropertyControlInfo.CreateFor(property);
if (Name != null) info.SetPropertyControlValue(property.Name, ControlInfoPropertyNames.DisplayName, Name);
if (Description != null) info.SetPropertyControlValue(property.Name, ControlInfoPropertyNames.Description, Description);
return info;
}
示例11: OnValueChanged
private void OnValueChanged(Property property, object newValue) {
var field = GetType().GetField(property.Name);
if(newValue != null && !newValue.GetType().IsSubtypeOrEqualTo(field.FieldType))
return;
field.SetValue(this, newValue);
}
示例12: SimplePropertyListTemplate
public SimplePropertyListTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Property prop)
: base(_host)
{
this.ctx = ctx;
this.prop = prop;
}
示例13: Cursor
public Cursor(Entity ent, String name)
: base(ent, name)
{
m_Position = Entity.AddProperty<Vector3>("Position", Vector3.Zero);
Broadphases.Input inp = XNAGame.Instance.GetBroadphase<Broadphases.Input>("Input");
inp.MouseMoved += new Broadphases.MouseEventHandler(inp_MouseMoved);
}
示例14: CollectProperties
private void CollectProperties(object instance, PropertyDescriptor descriptor, List<Property> propertyCollection, bool automaticlyExpandObjects, string filter)
{
if (descriptor.Attributes[typeof(FlatAttribute)] == null)
{
Property property = new Property(instance, descriptor);
if (descriptor.IsBrowsable)
{
//Add a property with Name: AutomaticlyExpandObjects
Type propertyType = descriptor.PropertyType;
if (automaticlyExpandObjects && propertyType.IsClass && !propertyType.IsArray && propertyType != typeof(string))
{
propertyCollection.Add(new ExpandableProperty(instance, descriptor, automaticlyExpandObjects, filter));
}
else if (descriptor.Converter.GetType() == typeof(ExpandableObjectConverter))
{
propertyCollection.Add(new ExpandableProperty(instance, descriptor, automaticlyExpandObjects, filter));
}
else
propertyCollection.Add(property);
}
}
else
{
instance = descriptor.GetValue(instance);
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(instance);
foreach (PropertyDescriptor propertyDescriptor in properties)
{
CollectProperties(instance, propertyDescriptor, propertyCollection, automaticlyExpandObjects, filter);
}
}
}
示例15: Create
/// <summary>
/// Create a new option.
/// </summary>
/// <param name="opco">The three or four letter code for the operating company</param>
/// <param name="name">The human-readable name for this option</param>
/// <param name="slug">A unique slug for this option; optional, will be generated from the name if not provided</param>
/// <param name="external">An third-party external identifier for this option (optional)</param>
/// <param name="language">The two-letter ISO language for the option's name; defaults to the opco's language</param>
/// <param name="relatedTo">The category or taxonomy using this option (optional)</param>
/// <param name="relatedBy">The property by which this option is related to the relatedTo value</param>
/// <returns>The newly created Option</returns>
/// <exception cref="Terra.ServerException">
/// <list type="bullet">
/// <item>
/// <description>If any of the parameters submitted are invalid, returns a status of Not Acceptable.</description>
/// </item>
/// <item>
/// <description>If the slug already exists, returns a status of Conflict.</description>
/// </item>
/// <item>
/// <description>If the operating company, relatedTo, or relatedBy does not exist, returns a status of Not Found.</description>
/// </item>
/// </list>
/// </exception>
public Option Create(string opco, string name, string slug = null, string external = null, string language = null,
Node relatedTo = null, Property relatedBy = null)
{
var request = _client.Request("option", Method.POST).
AddParameter("opco", opco).
AddParameter("name", name).
AddParameter("slug", slug).
AddParameter("external", external).
AddParameter("lang", language);
if (relatedBy != null)
{
if (relatedTo is Taxonomy)
{
request.AddParameter("taxonomy", ((Taxonomy)relatedTo).Slug);
}
else if (relatedTo is Category)
{
request.AddParameter("category", ((Category)relatedTo).Slug);
}
request.AddParameter("property", relatedBy.Slug);
}
return request.MakeRequest<Option>();
}