本文整理汇总了C#中Attribute类的典型用法代码示例。如果您正苦于以下问题:C# Attribute类的具体用法?C# Attribute怎么用?C# Attribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Attribute类属于命名空间,在下文中一共展示了Attribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadAttribute
public static Attribute LoadAttribute( AttributeName name )
{
Attribute att = new Attribute();
att.BaseValue = PlayerPrefs.GetInt(((AttributeName)name).ToString() + BASE_VALUE, 0);
att.ExpToLevel = PlayerPrefs.GetInt(((AttributeName)name).ToString() + EXP_TO_LEVEL, Attribute.STARTING_EXP_COST);
return att;
}
开发者ID:senkay,项目名称:unitygame,代码行数:7,代码来源:GameSetting2.cs
示例2: AppendEntityReferences
public static void AppendEntityReferences(this XElement element, Eav.Entity entity, Attribute attribute)
{
var entityGuids = attribute.ToSIC_EAV_EntityRelationships.Where(rel => rel.ParentEntityID == entity.EntityID)
.Select(rel => rel.ChildEntity.EntityGUID);
var entityGuidsString = string.Join(",", entityGuids);
element.Append(attribute.StaticName, entityGuidsString);
}
开发者ID:2sic,项目名称:eav-server,代码行数:7,代码来源:XElementExtension2.cs
示例3: DatumSchema
public DatumSchema(
Attribute[] attributes,
Predicate<string> answerValidator)
{
Attributes = attributes;
AnswerValidator = answerValidator;
}
开发者ID:Quackmatic,项目名称:DecisionTreeEntropyGenerator,代码行数:7,代码来源:DatumSchema.cs
示例4: AddAttribute
public Attribute AddAttribute(string name, string value, char quotechar, bool caseInsensitive)
{
Attribute a;
for (int i = 0, n = this.attributes.Count; i < n; i++)
{
a = (Attribute)this.attributes[i];
if (caseInsensitive && string.Compare(a.Name, name, true) == 0)
{
return null;
}
else if ((object)a.Name == (object)name)
{
return null;
}
}
a = (Attribute)this.attributes.Push();
if (a == null)
{
a = new Attribute();
this.attributes[this.attributes.Count - 1] = a;
}
a.Reset(name, value, quotechar);
return a;
}
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:26,代码来源:Node.cs
示例5: SetupPrimaryAttributes
private void SetupPrimaryAttributes()
{
for (int cnt = 0; cnt < _primaryAttribute.Length; cnt++)
{
_primaryAttribute[cnt] = new Attribute();
}
}
开发者ID:ahmetacer5,项目名称:project-unity,代码行数:7,代码来源:BaseCharacter.cs
示例6: ConvertToAttributeAstTypes
public static IEnumerable<Attribute> ConvertToAttributeAstTypes(this IEnumerable<IAttribute> attributes)
{
foreach (var attr in attributes)
{
var attributeAst = attr.AttributeType.ToAstSyntaxType();
var attribute =
new Attribute
{
Type = attributeAst,
Role = Roles.Attribute
};
foreach (var positionalArg in attr.PositionalArguments)
{
attribute.Arguments.Add(new PrimitiveExpression(positionalArg.ConstantValue));
}
foreach (var namedArg in attr.NamedArguments)
{
attribute.Arguments.Add(new NamedExpression(
namedArg.Key.Name,
new PrimitiveExpression(namedArg.Value.ConstantValue)));
}
yield return attribute;
}
}
开发者ID:prescottadam,项目名称:pMixins,代码行数:28,代码来源:IAttributeExtensions.cs
示例7: DeserializePropertiesFromResources
protected void DeserializePropertiesFromResources (
IDesignerSerializationManager manager,
Object value,
Attribute[] filter )
{
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:CodeDomSerializer.cs
示例8: ApplyAttribute
/// <summary>
/// Applies a loaded attribute
/// </summary>
/// <param name="attribute">attribute</param>
public void ApplyAttribute(Attribute attribute)
{
if (attribute.Key.EndsWith("Mana Amount")) {
manaBaseBox.Text = ((int)attribute.Initial).ToString();
manaBonusBox.Text = ((int)attribute.Scale).ToString();
}
}
开发者ID:Eniripsa96,项目名称:SkillAPITool,代码行数:11,代码来源:ManaEffect.xaml.cs
示例9: Attribute
public void Attribute()
{
Attribute inter = new Attribute(controller);
inter.PositionalArguments.Add("asdfsadf");
Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:7,代码来源:Specs_For_Base_Construct_Clone.cs
示例10: Gain
private double Gain(List<List<string>> Examples, Attribute A, string bestat)
{
double result;
int CountPositives = 0;
int[] CountPositivesA = new int[A.LValue.Count]; int[] CountNegativeA = new int[A.LValue.Count]; int Col = Attributes.IndexOf(A);
for (int i = 0; i < A.LValue.Count; i++)
{
CountPositivesA[i] = 0;
CountNegativeA[i] = 0;
}
for (int i = 0; i < Examples.Count; i++)
{
int j = A.LValue.IndexOf(Examples[i][Col].ToString());
if (Examples[i][Examples[0].Count - 1] == "yes")
{
CountPositives++;
CountPositivesA[j]++;
}
else
{
CountNegativeA[j]++;
}
}
result = GetEntropy(CountPositives, Examples.Count - CountPositives); for (int i = 0; i < A.LValue.Count; i++)
{
double RateValue = (double)(CountPositivesA[i] + CountNegativeA[i]) /
Examples.Count;
result = result - RateValue * GetEntropy(CountPositivesA[i], CountNegativeA[i]);
}
Solution = Solution + "\n * Gain(" + bestat + "," + A.Name + ") = " + result.ToString();
return result;
}
开发者ID:cs-team-uit,项目名称:ID3,代码行数:32,代码来源:DecisionTree.cs
示例11: GetProperties
/// <summary>
/// <para>Gets a collection of properties for the type of array specified by the value parameter.</para>
/// </summary>
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
if (value == null)
{
return null;
}
PropertyDescriptor[] props = null;
if (value.GetType().IsArray)
{
Array valueArray = (Array)value;
int length = valueArray.GetLength(0);
props = new PropertyDescriptor[length];
Type arrayType = value.GetType();
Type elementType = arrayType.GetElementType();
for (int i = 0; i < length; i++)
{
props[i] = new ArrayPropertyDescriptor(arrayType, elementType, i);
}
}
return new PropertyDescriptorCollection(props);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:29,代码来源:ArrayConverter.cs
示例12: ApplyAttribute
/// <summary>
/// Applies a loaded attribute
/// </summary>
/// <param name="attribute">attribute</param>
public void ApplyAttribute(Attribute attribute)
{
if (attribute.Key.EndsWith("Mana Percent")) {
percentBaseBox.Text = attribute.Initial.ToString();
percentBonusBox.Text = attribute.Scale.ToString();
}
}
开发者ID:Eniripsa96,项目名称:SkillAPITool,代码行数:11,代码来源:ManaDamageEffect.xaml.cs
示例13: foreach
public int this[string name]
{
get
{
foreach (Attribute attribute in this)
{
if (attribute.Name == name)
return attribute.Value;
}
return int.MinValue;
}
set
{
foreach (Attribute attribute in this)
{
if (attribute.Name == name)
{
attribute.Value = value;
return;
}
}
var attr = new Attribute {Name = name, Value = value};
List.Add(attr);
}
}
开发者ID:iraychen,项目名称:MSGReader,代码行数:26,代码来源:Attribute.cs
示例14: AddAttribute
private void AddAttribute(
Attribute a)
{
DerObjectIdentifier oid = a.AttrType;
object obj = attributes[oid];
if (obj == null)
{
attributes[oid] = a;
}
else
{
IList v;
if (obj is Attribute)
{
v = Platform.CreateArrayList();
v.Add(obj);
v.Add(a);
}
else
{
v = (IList) obj;
v.Add(a);
}
attributes[oid] = v;
}
}
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:31,代码来源:AttributeTable.cs
示例15: ApplyAttribute
/// <summary>
/// Applies a loaded attribute
/// </summary>
/// <param name="attribute">attribute</param>
public void ApplyAttribute(Attribute attribute)
{
if (attribute.Key.EndsWith("Push Speed")) {
pushBaseBox.Text = attribute.Initial.ToString();
pushBonusBox.Text = attribute.Scale.ToString();
}
}
开发者ID:Eniripsa96,项目名称:SkillAPITool,代码行数:11,代码来源:PushEffect.xaml.cs
示例16: AddAttribute
public void AddAttribute(ref Attribute newAttribute, int indexCreation, int indexUpdate)
{
attributesCreation[indexCreation]=newAttribute;
if (indexUpdate!=-1){ // if present only
attributesUpdate[indexUpdate]=newAttribute;
}
}
开发者ID:hdneo,项目名称:mxo-hd,代码行数:7,代码来源:GameObject.cs
示例17: SingleTableQuery
public SingleTableQuery(int qId, List<Attribute> qProjectedAttrs, List<Table> qTables,
Attribute qSelectedAttribute, String qSelectedAttributeValue,
double qPercentSelection, Table qTable, int qConfig = 0)
: base(qId, qProjectedAttrs, qTables, qSelectedAttribute, qSelectedAttributeValue, qPercentSelection, qConfig)
{
this.queryTable = qTable;
}
开发者ID:uwdb,项目名称:PSLAManager,代码行数:7,代码来源:SingleTableQuery.cs
示例18: ApplyAttribute
/// <summary>
/// Applies a loaded attribute
/// </summary>
/// <param name="attribute">attribute</param>
public void ApplyAttribute(Attribute attribute)
{
if (attribute.Key.EndsWith("Chance")) {
chanceBaseBox.Text = attribute.Initial.ToString();
chanceBonusBox.Text = attribute.Scale.ToString();
}
}
开发者ID:Eniripsa96,项目名称:SkillAPITool,代码行数:11,代码来源:ChanceEffect.xaml.cs
示例19: ApplyAttribute
/// <summary>
/// Applies a loaded attribute
/// </summary>
/// <param name="attribute">attribute</param>
public void ApplyAttribute(Attribute attribute)
{
if (attribute.Key.EndsWith("Heal")) {
damageBaseBox.Text = ((int)attribute.Initial).ToString();
damageBonusBox.Text = ((int)attribute.Scale).ToString();
}
}
开发者ID:Eniripsa96,项目名称:SkillAPITool,代码行数:11,代码来源:HealEffect.xaml.cs
示例20: ApplyAttribute
/// <summary>
/// Applies a loaded attribute
/// </summary>
/// <param name="attribute">attribute</param>
public void ApplyAttribute(Attribute attribute)
{
if (attribute.Key.EndsWith("Fire")) {
durationBaseBox.Text = attribute.Initial.ToString();
durationBonusBox.Text = attribute.Scale.ToString();
}
}
开发者ID:Eniripsa96,项目名称:SkillAPITool,代码行数:11,代码来源:FireEffect.xaml.cs
注:本文中的Attribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论