コード例 #1
0
ファイル: CarboMaterial.cs プロジェクト: JieGou/CarboLifeCalc
        public CarboProperty GetCarboProperty(string propertyName)
        {
            CarboProperty result = null;

            foreach (CarboProperty cp in Properties)
            {
                if (cp.PropertyName == propertyName)
                {
                    result = cp;
                    break;
                }
            }
            if (result == null)
            {
                result = new CarboProperty();
            }
            return(result);
        }
コード例 #2
0
ファイル: CarboMaterial.cs プロジェクト: JieGou/CarboLifeCalc
        public void SetProperty(string properyName, string propertyValue)
        {
            CarboProperty cpnew = new CarboProperty
            {
                PropertyName = properyName,
                Value        = propertyValue
            };
            bool isUnique = true;

            foreach (CarboProperty cp in Properties)
            {
                if (cp.PropertyName == cpnew.PropertyName)
                {
                    cp.Value = cpnew.Value;
                    isUnique = false;
                    break;
                }
            }
            if (isUnique == true)
            {
                Properties.Add(cpnew);
            }
        }