本文整理汇总了C#中FieldDescriptor.SetFieldToScalar方法的典型用法代码示例。如果您正苦于以下问题:C# FieldDescriptor.SetFieldToScalar方法的具体用法?C# FieldDescriptor.SetFieldToScalar怎么用?C# FieldDescriptor.SetFieldToScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldDescriptor
的用法示例。
在下文中一共展示了FieldDescriptor.SetFieldToScalar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeScalar
/// <summary>
///
/// </summary>
/// <param name="root"></param>
/// <param name="currentFieldDescriptor"></param>
private void DeserializeScalar(object root, FieldDescriptor currentFieldDescriptor)
{
NextEvent();
String value = _xmlReader.Value;
currentFieldDescriptor.SetFieldToScalar(root, value, translationContext);
NextEvent();
}
示例2: DeserializeScalar
/// <summary>
///
/// </summary>
/// <param name="root"></param>
/// <param name="currentFieldDescriptor"></param>
private void DeserializeScalar(object root, FieldDescriptor currentFieldDescriptor)
{
_jsonReader.Read();
if (_jsonReader.Value != null)
{
try
{
currentFieldDescriptor.SetFieldToScalar(root, _jsonReader.Value.ToString(), translationContext);
}
catch (Exception e)
{
Debug.WriteLine("Simpl Error. Failed to set scalar field: " + currentFieldDescriptor.Name + ". Skipping. Error: " + e.Message);
//_jsonReader.Skip();
}
}
else if (_jsonReader.TokenType == JsonToken.StartObject)
_jsonReader.Skip();
}
示例3: DeserializeScalar
/// <summary>
///
/// </summary>
/// <param name="root"></param>
/// <param name="currentFieldDescriptor"></param>
/// <returns></returns>
private int DeserializeScalar(Object root, FieldDescriptor currentFieldDescriptor)
{
byte[] value = _binaryReader.ReadBytes(_blockLength);
String stringValue = System.Text.Encoding.UTF8.GetString(value,0,value.Length);
currentFieldDescriptor.SetFieldToScalar(root, stringValue, translationContext);
return _blockLength;
}