/// <summary> /// Gets the binary serialized value of a property of an object by using a fast reflection way. /// </summary> /// <param name="targetObject">The object that contains the property.</param> /// <param name="propertyName">The name of the property.</param> /// <returns>Returns the value of the property as an array of byte.</returns> public byte[] GetPropertySerialized(object targetObject, string propertyName) { Requires.NotNull(targetObject, nameof(targetObject)); Requires.NotNullOrWhiteSpace(propertyName, nameof(propertyName)); var propertyValue = GetProperty(targetObject.GetType(), propertyName).Get(targetObject); return(SerializationHelper.ConvertToBinary(propertyValue)); }