public static IObjectDataValue CreateObjectValue(IObjectData objectData, IObjectData value) { // argument checks Debug.Assert(objectData != null); return(objectData.CreateValue(value)); }
public static IObjectDataValue CreateObjectValue <T>(this IObjectData data, T value, Action <T, IObjectData, bool> saveObject, string name, bool overwrite, bool omitDefault) { // argument checks Debug.Assert(data != null); Debug.Assert(saveObject != null); Debug.Assert(name != null || overwrite == false); IObjectData objectData = null; if (value != null) { // get IObjectData into which the value saves its contents if (overwrite) { // overwirte mode objectData = data.GetObjectValue(name, defaultValue: null); } if (objectData == null) { // create a empty IObjectData objectData = data.CreateObject(); } // save the value's contents saveObject(value, objectData, omitDefault); } return(data.CreateValue(objectData)); }
public static IObjectDataValue CreateArrayValue(IObjectData objectData, IEnumerable <IObjectDataValue> value) { // argument checks Debug.Assert(objectData != null); return(objectData.CreateValue(value)); }
public static IObjectDataValue CreatePasswordValue(IObjectData data, string value) { // argument checks Debug.Assert(data != null); // create password value return(data.CreateValue(string.IsNullOrEmpty(value) ? string.Empty : ProtectPassword(value))); }
private static IObjectDataValue CreateCultureInfoValue(IObjectData data, CultureInfo value) { // argument checks Debug.Assert(data != null); // create CultureInfo value return(data.CreateValue((value == null) ? null : value.Name)); }
public static IObjectDataValue CreateEnumValue(this IObjectData data, Enum value) { // argument checks Debug.Assert(data != null); Debug.Assert(value != null); return(data.CreateValue(value.ToString())); }
public static IObjectDataValue CreateArrayValue <T>(IObjectData data, IEnumerable <T> value, Func <IObjectData, T, IObjectDataValue> createItem) { // argument checks Debug.Assert(data != null); Debug.Assert(createItem != null); IEnumerable <IObjectDataValue> actualValue = (value == null) ? null : value.Select(t => createItem(data, t)); return(data.CreateValue(actualValue)); }
private static IObjectDataValue CreateIPAddressValue(IObjectData data, IPAddress value) { // argument checks Debug.Assert(data != null); Debug.Assert(value != null); // set IPAddress value string stringValue = value.ToString(); Debug.Assert(string.IsNullOrEmpty(stringValue) == false); return(data.CreateValue(stringValue)); }