本文整理汇总了C#中Wombat.MamaMsgField.getAsString方法的典型用法代码示例。如果您正苦于以下问题:C# MamaMsgField.getAsString方法的具体用法?C# MamaMsgField.getAsString怎么用?C# MamaMsgField.getAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wombat.MamaMsgField
的用法示例。
在下文中一共展示了MamaMsgField.getAsString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: displayField
private void displayField(MamaMsgField field)
{
Console.Write(String.Format("{0,20}{1,20}{2,20}",
field.getName(),
field.getFid(),
field.getTypeName()));
/*
The most efficient way of extracting data while iterating
fields is to obtain the field type and then call the
associated strongly-typed accessor.
MamaMsgField.getAsString() will return a string version
of the data but is considerably less efficient and is not
recommended for production use.
*/
switch(field.getType())
{
case mamaFieldType.MAMA_FIELD_TYPE_MSG:
MamaMsg myMsg = field.getMsg();
Console.WriteLine(" {");
displayAllFields(myMsg);
Console.WriteLine("}");
break;
default:
Console.WriteLine(String.Format("{0,20}",field.getAsString()));
break;
}
}
示例2: onField
/// <summary>
/// FieldIterator callback
/// </summary>
//////////////////////////////////////////////////////////////////////////////////////////////////
public void onField(MamaMsg msg,
MamaMsgField field,
object closure)
{
MamaFieldDescriptor descriptor = field.getDescriptor();
Console.WriteLine(descriptor.getName() + " : " + field.getAsString());
}
示例3: displayField
//.........这里部分代码省略.........
Console.WriteLine(indentSpacer + "}");
}
}
break;
case mamaFieldType.MAMA_FIELD_TYPE_STRING:
logMessage += field.getString();
break;
case mamaFieldType.MAMA_FIELD_TYPE_BOOL:
if (m_quietness < 1)
logMessage += field.getBool().ToString();
else
logMessage += field.getBool();
break;
case mamaFieldType.MAMA_FIELD_TYPE_CHAR:
if (m_quietness < 1)
logMessage += field.getChar().ToString();
else
logMessage += field.getChar();
break;
case mamaFieldType.MAMA_FIELD_TYPE_I8:
if (m_quietness < 1)
logMessage += field.getI8().ToString();
else
logMessage += field.getI8();
break;
case mamaFieldType.MAMA_FIELD_TYPE_U8:
if (m_quietness < 1)
logMessage += field.getU8().ToString();
else
logMessage += field.getU8();
break;
case mamaFieldType.MAMA_FIELD_TYPE_I16:
if (m_quietness < 1)
logMessage += field.getI16().ToString();
else
logMessage += field.getI16();
break;
case mamaFieldType.MAMA_FIELD_TYPE_U16:
if (m_quietness < 1)
logMessage += field.getU16().ToString();
else
logMessage += field.getU16();
break;
case mamaFieldType.MAMA_FIELD_TYPE_I32:
if (m_quietness < 1)
logMessage += field.getI32().ToString();
else
logMessage += field.getI32();
break;
case mamaFieldType.MAMA_FIELD_TYPE_U32:
if (m_quietness < 1)
logMessage += field.getU32().ToString();
else
logMessage += field.getU32();
break;
case mamaFieldType.MAMA_FIELD_TYPE_I64:
if (m_quietness < 1)
logMessage += field.getI64().ToString();
else
logMessage += field.getI64();
break;
case mamaFieldType.MAMA_FIELD_TYPE_U64:
if (m_quietness < 1)
logMessage += field.getU64().ToString();
else
logMessage += field.getU64();
break;
case mamaFieldType.MAMA_FIELD_TYPE_F32:
if (m_quietness < 1)
logMessage += field.getF32().ToString();
else
logMessage += field.getF32();
break;
case mamaFieldType.MAMA_FIELD_TYPE_F64:
if (m_quietness < 1)
logMessage += field.getF64().ToString();
else
logMessage += field.getF64();
break;
case mamaFieldType.MAMA_FIELD_TYPE_TIME:
if (m_quietness < 1)
logMessage += field.getDateTime().ToString();
else
logMessage += field.getDateTime();
break;
case mamaFieldType.MAMA_FIELD_TYPE_PRICE:
if (m_quietness < 1)
logMessage += field.getPrice().getAsString();
else
logMessage += field.getPrice();
break;
default:
logMessage += field.getAsString();
break;
}
Console.WriteLine(logMessage);
}