Server.Commands.Properties.GetValue C# (CSharp) Méthode

GetValue() public static méthode

public static GetValue ( Mobile from, object o, string name ) : string
from Mobile
o object
name string
Résultat string
		public static string GetValue( Mobile from, object o, string name )
		{
			string failReason = "";

			PropertyInfo[] chain = GetPropertyInfoChain( from, o.GetType(), name, PropertyAccess.Read, ref failReason );

			if ( chain == null || chain.Length == 0 )
				return failReason;

			PropertyInfo p = GetPropertyInfo( ref o, chain, ref failReason );

			if ( p == null )
				return failReason;

			return InternalGetValue( o, p, chain );
		}

Usage Example

        public override void Execute(CommandEventArgs e, object obj)
        {
            if (e.Length == 1)
            {
                string result = Properties.GetValue(e.Mobile, obj, e.GetString(0));

                if (result == "Property not found." || result == "Property is write only." || result.StartsWith("Getting this property"))
                {
                    LogFailure(result);
                }
                else
                {
                    AddResponse(result);
                }
            }
            else
            {
                LogFailure("Format: Get <propertyName>");
            }
        }
All Usage Examples Of Server.Commands.Properties::GetValue