PM.BLL/Extensions/ICommandExtensions.cs
/// <summary>
/// Updates the cooresponding property in PMData with the value of the command
/// </summary>
/// <param name="command">The command</param>
/// <param name="pmData">The PMData object to update</param>
Updates the cooresponding property in PMData with the value of the command
Updates the cooresponding property in PMData with the value of the command
public static void UpdatePMData(this ICommand command, PMData pmData)
        {
            if (pmData == null)
            {
                return;
            }
            if (command.Value == null)
            {
                return;
            }
            PropertyInfo? property = pmData.GetType().GetProperty(command.Name);
            if (property == null)
            {
                return;
            }
            if (Nullable.GetUnderlyingType(property.PropertyType) != command.Value.GetType())
            {
                return;
            }
            property.SetValue(pmData, command.Value);
        }
public static void UpdatePMData ( this ICommand command , PMData pmData ) { if ( pmData == null ) { return ; } if ( command . Value == null ) { return ; } PropertyInfo ? property = pmData . GetType ( ) . GetProperty ( command . Name ) ; if ( property == null ) { return ; } if ( Nullable . GetUnderlyingType ( property . PropertyType ) != command . Value . GetType ( ) ) { return ; } property . SetValue ( pmData , command . Value ) ; }
Updates the cooresponding property in PMData with the value of the command
Updates the cooresponding property in PMData with the value of the command
ICommand
this
pmData
PMData
The PMData object to update
The PMData object to update
command
None