• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Property类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Property的典型用法代码示例。如果您正苦于以下问题:C# Property类的具体用法?C# Property怎么用?C# Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Property类属于命名空间,在下文中一共展示了Property类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetData

        public void GetData(ref DBQueryUC dBQueryUC)
        {
            //Input Parameter
            List<Property> listProPerty_Input = new List<Property>();

            for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
            {
                Property property = new Property();
                property.PropertyName = dataGridView2.Rows[i].Cells[0].Value.ToString();
                listProPerty_Input.Add(property);
            }
            dBQueryUC.InputParameter = new InputParameter();
            dBQueryUC.InputParameter.Properties = listProPerty_Input;

            //Output Parameter
            List<Property> listProPerty_Output = new List<Property>();
            for (int i = 0; i < dataGridView3.Rows.Count - 1; i++)
            {
                Property property = new Property();
                property.PropertyName = dataGridView3.Rows[i].Cells[0].Value.ToString();
                listProPerty_Output.Add(property);
            }
            dBQueryUC.OutputParameter = new OutputParameter();
            dBQueryUC.OutputParameter.Properties = listProPerty_Output;

            dBQueryUC.SqlQuery = richTextBox1.Text;
        }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:27,代码来源:ConfugurationQuery.cs


示例2: Board

        public Board()
        {
            propertysquares[0] = new Property { name = "go",
                price = 0,
                hotelprice = 0,
                colour = "nonproperty",
                canbesold = false,
                canhavehouses = false,
                houseprice = 0,
                ischance = false,
                iscommunityChest = false,
                hashotel = false,
                issold = false,
                numberofhouses = 0,
                rentprice = -200 };

            propertysquares[2] = new Property
            {
                name = "mayfair",
                price = 400,
                hotelprice = 250,
                colour = "Dark Blue",
                canbesold = true,
                canhavehouses = true,
                houseprice = 0,
                ischance = false,
                iscommunityChest = false,
                hashotel = false,
                issold = false,
                numberofhouses = 0,
                rentprice = 50
            };
        }
开发者ID:06needhamt,项目名称:Stuffimake,代码行数:33,代码来源:Board.cs


示例3: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            authenticationMode = EmailTraceListener.Property("AuthenticationMode");
            authenticationMode.Value = EmailAuthenticationMode.UserNameAndPassword;
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:7,代码来源:given_email_trace_listener.cs


示例4: getUser

    public int getUser(Property objUser)
    {
        SqlConnection sqlCon = new SqlConnection(conStr);
        SqlCommand sqlCmd = new SqlCommand("sp_verfiyEmail", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter eMailID = sqlCmd.Parameters.Add("@EmailID", SqlDbType.VarChar, 50);
        eMailID.Value = objUser.EmailID;

        SqlParameter passWordRem = sqlCmd.Parameters.Add("@PwdRem", SqlDbType.VarChar, 50);
        passWordRem.Value = objUser.PwdRem;

        SqlParameter flag = sqlCmd.Parameters.Add("@Flag", SqlDbType.Int);
        flag.Direction = ParameterDirection.Output;
        flag.Value = 0;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();
            if ((int)flag.Value == 1)
                eMailFlag = 1;
            else
                eMailFlag = 0;
        }
        catch (Exception ex)
        { }
        finally
        {
            sqlCon.Close();
        }

        return eMailFlag;
    }
开发者ID:aptivasoft,项目名称:Adio,代码行数:34,代码来源:CheckEmailDAL.cs


示例5: Export

        public void Export(Property property, XElement propertyTag, Dictionary<int, ObjectTypes> dependantNodes)
        {
            if (property.Value != null && !string.IsNullOrWhiteSpace(property.Value.ToString()))
            {
                var items = new DampModel(property.Value.ToString());
                var guidList = new List<Guid>();

                if (items.Any)
                {
                    foreach (var item in items)
                    {
                        var media = Services.MediaService.GetById(item.Id);
                        if (media != null)
                        {
                            guidList.Add(Services.MediaService.GetById(item.Id).Key);

                            if (!dependantNodes.ContainsKey(item.Id))
                            {
                                dependantNodes.Add(item.Id, ObjectTypes.Media);
                            }
                        }
                    }
                }

                propertyTag.Value = string.Join(",", guidList);
            }
        }
开发者ID:EnjoyDigital,项目名称:Conveyor,代码行数:27,代码来源:DampDataTypeConverter.cs


示例6: ClearanceException

 public ClearanceException(Property property, AccessLevel playerAccess, AccessLevel neededAccess, string accessType)
     : base(property, string.Format(
     "You must be at least {0} to {1} this property.",
     Mobile.GetAccessLevelName(neededAccess),
     accessType))
 {
 }
开发者ID:FreeReign,项目名称:forkuo,代码行数:7,代码来源:Properties.cs


示例7: AddProperty

 public void AddProperty(Property property)
 {
     if (Properties.ContainsKey(property.Name))
         Properties[property.Name] = property;
     else
         Properties.Add(property.Name, property);
 }
开发者ID:SkightTeam,项目名称:eLiteWeb,代码行数:7,代码来源:BuildProject.cs


示例8: PostfixOptionsViewModel

        public PostfixOptionsViewModel([NotNull] Lifetime lifetime,
                                   [NotNull] OptionsSettingsSmartContext settings,
                                   [NotNull] PostfixTemplatesManager templatesManager)
        {
            mySettingsStore = settings;
              myTemplatesManager = templatesManager;
              Templates = new ObservableCollection<PostfixTemplateViewModel>();

              ShowPostfixTemplates = new Property<bool>(lifetime, "ShowPostfixTemplates");
              ShowStaticMembers = new Property<bool>(lifetime, "ShowStaticMembers");
              ShowEnumHelpers = new Property<bool>(lifetime, "ShowEnumHelpers");
              ShowLengthCountItems = new Property<bool>(lifetime, "ShowLengthCountItems");
              UseBracesForStatements = new Property<bool>(lifetime, "UseBracesForStatements");
              InvokeParameterInfo = new Property<bool>(lifetime, "InvokeParameterInfo");
              SearchVarOccurrences = new Property<bool>(lifetime, "SearchVarOccurrences");

              Reset = new DelegateCommand(ResetExecute);

              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowPostfixItems, ShowPostfixTemplates);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowStaticMethods, ShowStaticMembers);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowEnumHelpers, ShowEnumHelpers);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.BracesForStatements, UseBracesForStatements);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.InvokeParameterInfo, InvokeParameterInfo);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowLengthCountItems, ShowLengthCountItems);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.SearchVarOccurrences, SearchVarOccurrences);

              FillTemplates();
        }
开发者ID:Nangal,项目名称:resharper-postfix,代码行数:28,代码来源:PostfixOptionsViewModel.cs


示例9: AddPropertyToGameObject

 public void AddPropertyToGameObject()
 {
     GameObject newGameObject = new GameObject("new game object");
     Property newProperty = new Property(PropertyType.String, "new property", "a new value");
     Assert.IsTrue(newGameObject.AddProperty(newProperty));
     Assert.IsTrue(newGameObject.DoesPropertyExist(newProperty.Name));
 }
开发者ID:kraidleyaran,项目名称:GameObjectLib,代码行数:7,代码来源:GameObjectTest.cs


示例10: GetPropertyFromGameObject

 public void GetPropertyFromGameObject()
 {
     GameObject newGameObject = new GameObject("new game object");
     Property newProperty = new Property(PropertyType.String, "new property", "a new value");
     newGameObject.AddProperty(newProperty);
     Assert.IsTrue(newProperty.Value == newGameObject.GetProperty(newProperty.Name).Value);
 }
开发者ID:kraidleyaran,项目名称:GameObjectLib,代码行数:7,代码来源:GameObjectTest.cs


示例11: GenerateFeature

        /// <summary>Generates a feature.</summary>
        /// <exception cref="InvalidOperationException">Thrown when the requested operation is invalid.</exception>
        /// <param name="type">The type.</param>
        /// <param name="name">The name.</param>
        /// <returns>The feature.</returns>
        public static Property GenerateFeature(Type type, string name)
        {
            Property p;
            if (type == typeof(string))
                p = new StringProperty();
            else if (type == typeof(DateTime))
                p = new DateTimeProperty();
            else if (type.GetInterfaces().Contains(typeof(IEnumerable)))
                throw new InvalidOperationException(
                    string.Format("Property {0} needs to be labeled as an EnumerableFeature", name));
            else
                p = new Property();


            p.Discrete = type.BaseType == typeof(Enum) ||
                         type == typeof(bool) ||
                         type == typeof(string) ||
                         type == typeof(char) ||
                         type == typeof(DateTime);

            p.Type = type;
            p.Name = name;

            return p;
        }
开发者ID:m-abubakar,项目名称:numl,代码行数:30,代码来源:TypeHelpers.cs


示例12: Delete

 public async static Task<EntityResponse<Property>> Delete(Property propertyType)
 {
     using (var db = Database.Connect())
     {
         return await db.Entities.DeleteAsync<Property>(propertyType);
     }
 }
开发者ID:joelalejandro,项目名称:Adagi,代码行数:7,代码来源:Properties.cs


示例13: ImplementProperty_GenerateLineBreaks

        public void ImplementProperty_GenerateLineBreaks()
        {
            WithSourceFiles(Files.ChildClass, Files.Mixin);

            var typeSymbol = Substitute.For<ITypeSymbol>();
            var mixin = Substitute.For<MixinReference>();
            mixin.Name.Returns("_mixin");

            var property = new Property("Name", typeSymbol, true, true);

            var implementPropertyStrategy = new ImplementPropertyForwarding(
                mixin, Semantic, new Settings(avoidLineBreaksInProperties:false));

            var memberDeclaration = implementPropertyStrategy.ImplementMember(property, 0);

            // Assert:
            // let the formatting engine format the output source and ensure
            // that the text has only 6 lines:
            // <empty line>
            // public Name
            // { 
            //    get
            //    {
            //        ...
            //    }
            //    <empty line>
            //    ...
            // }

            var workspace = new AdhocWorkspace();
            memberDeclaration = (MemberDeclarationSyntax)Formatter.Format(memberDeclaration, workspace);
            var sourceText = SourceText.From(memberDeclaration.ToFullString());
            Assert.AreEqual(13, sourceText.Lines.Count);
        }
开发者ID:pgenfer,项目名称:mixinSharp,代码行数:34,代码来源:ImplementPropertyForwardingTest.cs


示例14: Biggylist_Updates_Single_Item_In_Json_Store

    public void Biggylist_Updates_Single_Item_In_Json_Store() {
      var propertyList = new BiggyList<Property>(_propertyStore);
      int initialCount = propertyList.Count;

      var newProperty = new Property { Id = 1, Name = "John's Luxury Apartments", Address = "2639 I St NW, Washington, D.C. 20037" };
      propertyList.Add(newProperty);

      int addedItemId = newProperty.Id;

      // Just to be sure, reload from backing store and check what was added:
      propertyList = new BiggyList<Property>(_propertyStore);
      var addedProperty = propertyList.FirstOrDefault(p => p.Id == addedItemId);
      bool isAddedProperly = addedProperty.Name.Contains("John's Luxury");

      // Now Update:
      string newName = "John's Low-Rent Apartments";
      addedProperty.Name = newName;
      propertyList.Update(addedProperty);

      // Go fetch again:
      propertyList = new BiggyList<Property>(_propertyStore);
      addedProperty = propertyList.FirstOrDefault(p => p.Id == addedItemId);
      bool isUpdatedProperly = addedProperty.Name == newName;

      Assert.IsTrue(isAddedProperly && isUpdatedProperly);
    }
开发者ID:ToughBill,项目名称:biggy,代码行数:26,代码来源:BiggyListWithJsonStore.cs


示例15: ContentDocument

        public ContentDocument(IDataTypeService service, IContent content)
            : this()
        {
            Id = content.Id;
            ContentTypeId = content.ContentTypeId;
            ContentType = content.ContentType.Name;
            Name = content.Name;
            ParentId = content.ParentId;
            Level = content.Level;
            Path = content.Path;

            foreach (var propInfo in content.PropertyTypes.OrderBy(n => n.SortOrder))
            {

                var p = new Property
                {
                    Name = propInfo.Name,
                    Alias = propInfo.Alias,
                    Description = propInfo.Description,
                    Required = propInfo.Mandatory,
                    Validation = propInfo.ValidationRegExp,
                    DataType = service.GetDataTypeDefinitionById(propInfo.DataTypeDefinitionId).Name,
                    Value = (content.Properties.SingleOrDefault(n => n.Alias == propInfo.Alias).Value ?? string.Empty).ToString()
                };
                Properties.Add(p);
            }
        }
开发者ID:MindfireTechnology,项目名称:UmbracoDynamicDoc,代码行数:27,代码来源:ContentDocument.cs


示例16: btnSaveNewPwd_Click

    protected void btnSaveNewPwd_Click(object sender, ImageClickEventArgs e)
    {
        RegisterUserBLL objUser = new RegisterUserBLL();
        Property objProp = new Property();

        objProp.UserID = txtUserID.Text;
        objProp.OldPassword = txtOldPwd.Text;
        objProp.Password = txtNewPassword.Text;

        string user = (string)Session["User"];

        try
        {
            if (objUser.ChangePassword(objProp, user))
            {
                string str = "alert('Password Changed Successfully...');";
                ScriptManager.RegisterStartupScript(btnSaveNewPwd, typeof(Page), "alert", str, true);
            }
            else
            {
                string str = "alert('Failed to Change Password, Please try again...');";
                ScriptManager.RegisterStartupScript(btnSaveNewPwd, typeof(Page), "alert", str, true);
            }
            ClearControls();
        }
        catch(Exception ex)
        {
            objNLog.Error("Error: " + ex.Message);
        }
    }
开发者ID:aptivasoft,项目名称:Adio,代码行数:30,代码来源:ChangePassword.aspx.cs


示例17: AddProperty

        public static String AddProperty(Property prop)
        {
            String ReturnpropertyID = String.Empty;

               //if (!(IsExistingProperty(prop)))
               //{
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.Properties.AddObject(prop);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           ReturnpropertyID = prop.ID.ToString();
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               //}//if

               return ReturnpropertyID;
        }
开发者ID:arnabknd4,项目名称:scs0400915,代码行数:29,代码来源:DALProperty.cs


示例18: Test

		public void Test()
		{
			var property = new Property { Name = "Property 1" };
			using (var session = OpenSession())
			{
				using (var tx = session.BeginTransaction())
				{
					session.Save(property);

					tx.Commit();
				}

				var item = new Item();
				using (var tx = session.BeginTransaction())
				{
					item.Name = "Item 1";
					item.PropertyValues = new Dictionary<Guid, PropertyValue>
											  {
												  {property.Id, new PropertyValue {Value = "Value 1"}}
											  };

					session.Save(item);

					tx.Commit();
				}
				session.Clear();

				var savedItem = session.Get<Item>(item.Id);
				Assert.AreEqual(1, savedItem.PropertyValues.Count);
				Assert.AreEqual("Value 1", savedItem.PropertyValues[property.Id].Value);
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:32,代码来源:InvalidCastTestCase.cs


示例19: CreateProperty

        public static Boolean CreateProperty(Property prop )
        {
            String propertyID = String.Empty;
               Boolean flag = false;
               if (!(IsExistingProperty(prop)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.Properties.AddObject(prop);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           propertyID = prop.ID.ToString();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }
开发者ID:arnabknd4,项目名称:scs0400915,代码行数:30,代码来源:DALProperty.cs


示例20: ModelTemplateModel

        /// <summary>
        /// Initializes a new instance of the ModelTemplateModel class.
        /// </summary>
        /// <param name="source">The object to create model from.</param>
        /// <param name="allTypes">The list of all model types; Used to implement polymorphism.</param>
        public ModelTemplateModel(CompositeType source, ISet<CompositeType> allTypes)
        {
            this.LoadFrom(source);
            PropertyTemplateModels = new List<PropertyTemplateModel>();
            source.Properties.ForEach(p => PropertyTemplateModels.Add(new PropertyTemplateModel(p)));

            if (!string.IsNullOrEmpty(source.PolymorphicDiscriminator))
            {
                if (!source.Properties.Any(p => p.Name == source.PolymorphicDiscriminator))
                {
                    var polymorphicProperty = new Property
                    {
                        IsRequired = true,
                        Name = source.PolymorphicDiscriminator,
                        SerializedName = source.PolymorphicDiscriminator,
                        Documentation = "Polymorhpic Discriminator",
                        Type = new PrimaryType(KnownPrimaryType.String)
                    };
                    source.Properties.Add(polymorphicProperty);
                }
            }

            if (source.BaseModelType != null)
            {
                this.parent = new ModelTemplateModel(source.BaseModelType, allTypes);
            }

            this.allTypes = allTypes;
        }
开发者ID:jhancock93,项目名称:autorest,代码行数:34,代码来源:ModelTemplateModel.cs



注:本文中的Property类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PropertyAccess类代码示例发布时间:2022-05-24
下一篇:
C# Properties类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap