internal static IEnumerable <TValue> GetExtendedValues <TValue>(IExtensible instance, int tag, DataFormat format, bool singleton, bool allowDefinedTag) { foreach (TValue extendedValue in ExtensibleUtil.GetExtendedValues(RuntimeTypeModel.Default, typeof(TValue), instance, tag, format, singleton, allowDefinedTag)) { yield return(extendedValue); } }
// Token: 0x0600328E RID: 12942 RVA: 0x0012734C File Offset: 0x0012574C public static bool TryGetValue(TypeModel model, Type type, IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out object value) { value = null; bool result = false; IEnumerator enumerator = ExtensibleUtil.GetExtendedValues(model, type, instance, tag, format, true, allowDefinedTag).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; value = obj; result = true; } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } return(result); }
public static bool TryGetValue(TypeModel model, Type type, IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out object value) { value = null; bool result = false; foreach (object extendedValue in ExtensibleUtil.GetExtendedValues(model, type, instance, tag, format, singleton: true, allowDefinedTag)) { object obj = value = extendedValue; result = true; } return(result); }
public static bool TryGetValue <TValue>(IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out TValue value) { value = default(TValue); bool result = false; foreach (TValue extendedValue in ExtensibleUtil.GetExtendedValues <TValue>(instance, tag, format, singleton: true, allowDefinedTag)) { TValue val = value = extendedValue; result = true; } return(result); }
// Token: 0x06000061 RID: 97 RVA: 0x00002485 File Offset: 0x00000685 internal static IEnumerable <TValue> GetExtendedValues <TValue>(IExtensible instance, int tag, DataFormat format, bool singleton, bool allowDefinedTag) { foreach (object obj in ExtensibleUtil.GetExtendedValues(RuntimeTypeModel.Default, typeof(TValue), instance, tag, format, singleton, allowDefinedTag)) { TValue tvalue = (TValue)((object)obj); yield return(tvalue); } IEnumerator enumerator = null; yield break; yield break; }
/// <summary> /// Queries an extensible object for an additional (unexpected) data-field for the instance. /// The value returned (in "value") is the composed value after merging any duplicated content; /// if the value is "repeated" (a list), then use GetValues instead. /// </summary> /// <param name="type">The data-type of the field.</param> /// <param name="model">The model to use for configuration.</param> /// <param name="value">The effective value of the field, or the default value if not found.</param> /// <param name="instance">The extensible object to obtain the value from.</param> /// <param name="tag">The field identifier; the tag should not be defined as a known data-field for the instance.</param> /// <param name="format">The data-format to use when decoding the value.</param> /// <param name="allowDefinedTag">Allow tags that are present as part of the definition; for example, to query unknown enum values.</param> /// <returns>True if data for the field was present, false otherwise.</returns> public static bool TryGetValue(TypeModel model, System.Type type, IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out object value) { value = null; bool set = false; foreach (object val in ExtensibleUtil.GetExtendedValues(model, type, instance, tag, format, true, allowDefinedTag)) { // expecting at most one yield... // but don't break; need to read entire stream value = val; set = true; } return(set); }
/// <summary> /// Queries an extensible object for an additional (unexpected) data-field for the instance. /// The value returned (in "value") is the composed value after merging any duplicated content; /// if the value is "repeated" (a list), then use GetValues instead. /// </summary> /// <typeparam name="TValue">The data-type of the field.</typeparam> /// <param name="value">The effective value of the field, or the default value if not found.</param> /// <param name="instance">The extensible object to obtain the value from.</param> /// <param name="tag">The field identifier; the tag should not be defined as a known data-field for the instance.</param> /// <param name="format">The data-format to use when decoding the value.</param> /// <param name="allowDefinedTag">Allow tags that are present as part of the definition; for example, to query unknown enum values.</param> /// <returns>True if data for the field was present, false otherwise.</returns> public static bool TryGetValue <TValue>(IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out TValue value) { value = default(TValue); bool set = false; foreach (TValue val in ExtensibleUtil.GetExtendedValues <TValue>(instance, tag, format, true, allowDefinedTag)) { // expecting at most one yield... // but don't break; need to read entire stream value = val; set = true; } return(set); }
/// <summary> /// Queries an extensible object for an additional (unexpected) data-field for the instance. /// The value returned (in "value") is the composed value after merging any duplicated content; /// if the value is "repeated" (a list), then use GetValues instead. /// </summary> /// <param name="type">The data-type of the field.</param> /// <param name="model">The model to use for configuration.</param> /// <param name="value">The effective value of the field, or the default value if not found.</param> /// <param name="instance">The extensible object to obtain the value from.</param> /// <param name="tag">The field identifier; the tag should not be defined as a known data-field for the instance.</param> /// <param name="format">The data-format to use when decoding the value.</param> /// <param name="allowDefinedTag">Allow tags that are present as part of the definition; for example, to query unknown enum values.</param> /// <returns>True if data for the field was present, false otherwise.</returns> public static bool TryGetValue(TypeModel model, System.Type type, IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out object value) { value = null; bool set = false; var item = ExtensibleUtil.GetExtendedValues(model, type, instance, tag, format, true, allowDefinedTag).GetEnumerator(); while (item.MoveNext()) { value = item.Current; set = true; } return(set); }
public static bool TryGetValue <TValue>(IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out TValue value) { value = default(TValue); bool result = false; using (IEnumerator <TValue> enumerator = ExtensibleUtil.GetExtendedValues <TValue>(instance, tag, format, true, allowDefinedTag).GetEnumerator()) { while (enumerator.MoveNext()) { TValue current = enumerator.get_Current(); value = current; result = true; } } return(result); }
/// <summary> /// Queries an extensible object for an additional (unexpected) data-field for the instance. /// The value returned (in "value") is the composed value after merging any duplicated content; /// if the value is "repeated" (a list), then use GetValues instead. /// </summary> /// <typeparam name="TValue">The data-type of the field.</typeparam> /// <param name="value">The effective value of the field, or the default value if not found.</param> /// <param name="instance">The extensible object to obtain the value from.</param> /// <param name="tag">The field identifier; the tag should not be defined as a known data-field for the instance.</param> /// <param name="format">The data-format to use when decoding the value.</param> /// <param name="allowDefinedTag">Allow tags that are present as part of the definition; for example, to query unknown enum values.</param> /// <returns>True if data for the field was present, false otherwise.</returns> public static bool TryGetValue <TValue>(IExtensible instance, int tag, DataFormat format, bool allowDefinedTag, out TValue value) { value = default(TValue); bool set = false; var item = ExtensibleUtil.GetExtendedValues <TValue>(instance, tag, format, true, allowDefinedTag).GetEnumerator(); while (item.MoveNext()) { // expecting at most one yield... // but don't break; need to read entire stream TValue val = item.Current; value = val; set = true; } return(set); }
// Token: 0x06003291 RID: 12945 RVA: 0x001273D8 File Offset: 0x001257D8 internal static IEnumerable <TValue> GetExtendedValues <TValue>(IExtensible instance, int tag, DataFormat format, bool singleton, bool allowDefinedTag) { IEnumerator enumerator = ExtensibleUtil.GetExtendedValues(RuntimeTypeModel.Default, typeof(TValue), instance, tag, format, singleton, allowDefinedTag).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; TValue value = (TValue)((object)obj); yield return(value); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } yield break; }
/// <summary> /// Queries an extensible object for an additional (unexpected) data-field for the instance. /// Each occurrence of the field is yielded separately, making this usage suitable for "repeated" /// (list) fields. /// </summary> /// <remarks>The extended data is processed lazily as the enumerator is iterated.</remarks> /// <param name="model">The model to use for configuration.</param> /// <param name="type">The data-type of the field.</param> /// <param name="instance">The extensible object to obtain the value from.</param> /// <param name="tag">The field identifier; the tag should not be defined as a known data-field for the instance.</param> /// <param name="format">The data-format to use when decoding the value.</param> /// <returns>An enumerator that yields each occurrence of the field.</returns> public static IEnumerable GetValues(TypeModel model, System.Type type, IExtensible instance, int tag, DataFormat format) { return(ExtensibleUtil.GetExtendedValues(model, type, instance, tag, format, false, false)); }
/// <summary> /// Queries an extensible object for an additional (unexpected) data-field for the instance. /// Each occurrence of the field is yielded separately, making this usage suitable for "repeated" /// (list) fields. /// </summary> /// <remarks>The extended data is processed lazily as the enumerator is iterated.</remarks> /// <typeparam name="TValue">The data-type of the field.</typeparam> /// <param name="instance">The extensible object to obtain the value from.</param> /// <param name="tag">The field identifier; the tag should not be defined as a known data-field for the instance.</param> /// <param name="format">The data-format to use when decoding the value.</param> /// <returns>An enumerator that yields each occurrence of the field.</returns> public static IEnumerable <TValue> GetValues <TValue>(IExtensible instance, int tag, DataFormat format) { return(ExtensibleUtil.GetExtendedValues <TValue>(instance, tag, format, false, false)); }
public static IEnumerable GetValues(TypeModel model, Type type, IExtensible instance, int tag, DataFormat format) { return(ExtensibleUtil.GetExtendedValues(model, type, instance, tag, format, singleton: false, allowDefinedTag: false)); }
public static IEnumerable <TValue> GetValues <TValue>(IExtensible instance, int tag, DataFormat format) { return(ExtensibleUtil.GetExtendedValues <TValue>(instance, tag, format, singleton: false, allowDefinedTag: false)); }