本文整理汇总了C#中System.Reflection.FieldInfo.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FieldInfo.ToString方法的具体用法?C# FieldInfo.ToString怎么用?C# FieldInfo.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.FieldInfo
的用法示例。
在下文中一共展示了FieldInfo.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OkToUse
public bool OkToUse(FieldInfo f, out string message)
{
if (f == null) throw new ArgumentNullException("f");
return OkToUseInternal(f.ToString(), this.require_fields, this.forbid_fields, out message);
}
示例2: ReadDateTime
private static DateTime ReadDateTime(BinaryParser parser, FieldInfo field)
{
var attr = BinaryParser.GetAttribute<BinaryFieldAttribute>(field);
if (attr != null)
{
if (attr.FieldType == BinaryFieldType.UnixTime)
{
return UnixTime.ToDateTime(parser.ReadUInt32());
}
}
PscxArgumentException.Throw("Don't know how to parse DateTime field " + field.ToString());
return DateTime.MinValue;
}
示例3: ReadVersion
private static Object ReadVersion(BinaryParser parser, FieldInfo field)
{
var attr = BinaryParser.GetAttribute<VersionFieldAttribute>(field);
if (attr != null)
{
var args = new Object[attr.ComponentCount];
for (int i = 0; i < args.Length; i++)
{
args[i] = ReadIntegral(parser, attr.ComponentType);
}
return Activator.CreateInstance(typeof(Version), args);
}
PscxArgumentException.Throw(field.Name, "Don't know how to parse field " + field.ToString());
return null;
}
示例4: ReadString
private static String ReadString(BinaryParser parser, FieldInfo field)
{
var attr = BinaryParser.GetAttribute<BinaryFieldAttribute>(field);
if (attr != null)
{
if (attr.FieldType == BinaryFieldType.StringAsciiZ)
{
if (attr.FixedLength > 0)
{
return parser.ReadStringAsciiZ();
}
return parser.ReadStringAsciiZ();
}
}
PscxArgumentException.Throw(field.Name, "Don't know how to parse field " + field.ToString());
return null;
}
示例5: Emit
public void Emit(OpCode opCode, FieldInfo fi)
{
ProcessCommand(opCode, 0, fi.ToString());
ilGenerator.Emit(opCode, fi);
}
示例6: Describe
internal static string Describe(FieldInfo fieldInfo)
{
return "{0} {1}{2} {3}".FormatInvariant(
Describe(fieldInfo.ReflectedType),
DescribeVisibility(fieldInfo),
fieldInfo.IsStatic ? " static" : String.Empty,
fieldInfo.ToString()
);
}
示例7: OkToUse
/// <summary>
/// Determines if the target field is ok to use.
/// </summary>
/// <param name="field">
/// The field to test.
/// </param>
/// <param name="message">
/// A message for the caller.
/// </param>
/// <returns>
/// True if the field is ok to use, false otherwise.
/// </returns>
public bool OkToUse(FieldInfo field, out string message)
{
if (field != null)
{
foreach (ForbidExpression fExp in this.forbiddenFields)
{
if (fExp.IsForbidden(field.ToString()))
{
message = string.Format("The Field {0} matches the ForbidExpression with pattern {1}. It will not be used.", field.ToString(), fExp.Pattern);
return false;
}
}
message = string.Format("The Field {0} will be used.", field.ToString());
return true;
}
else
{
message = "The passed in type argument was null";
throw new ArgumentNullException(message);
}
}