public static string GetMembersType(string variableName)
        {
            var keyType   = DebuggerHelper.GetValue(ExpressionsHelper.DictionaryKeyType(variableName)).Replace("\"", String.Empty).Replace("+", ".");
            var valueType = DebuggerHelper.GetValue(ExpressionsHelper.DictionaryValueType(variableName)).Replace("\"", String.Empty).Replace("+", ".");

            return(String.Concat(keyType, ", ", valueType));
        }
Пример #2
0
        public static List <ObjectInitialization> GetClassProperties(string variableName)
        {
            var classProperties = new List <ObjectInitialization>();

            var type = DebuggerHelper.GetValue(ExpressionsHelper.TypeFullName(variableName)).Replace("\"", String.Empty).Replace("+", ".");

            ////Need to cast it to specific type when enumeration contains abstract types
            foreach (string propertyName in DebuggerHelper.GetMembersName(ExpressionsHelper.Cast(variableName, type)))
            {
                if (IsPropertyInitializable(variableName, propertyName))
                {
                    var propertyInitialization = ObjectInitializationFactory.CreateObjectInitialization(String.Concat(variableName, ".", propertyName));

                    if (propertyInitialization != null)
                    {
                        classProperties.Add(propertyInitialization);
                    }
                }
            }

            return(classProperties);
        }
Пример #3
0
 private static bool IsPropertyWritable(string variableName, string propertyName)
 {
     return("true" == DebuggerHelper.GetValue(ExpressionsHelper.CanWrite(variableName, propertyName)).ToLower());
 }
Пример #4
0
 private static bool IsFieldPublic(string variableName, string propertyName)
 {
     return("false" == DebuggerHelper.GetValue(ExpressionsHelper.IsInitOnly(variableName, propertyName)).ToLower());
 }
Пример #5
0
 private static bool IsDictionary(string variableName)
 {
     return("\"Dictionary`2\"" == DebuggerHelper.GetValue(ExpressionsHelper.TypeName(variableName)));
 }
Пример #6
0
 private static bool IsDatetime(string variableName)
 {
     //pourrait être plus précis
     return(DebuggerHelper.GetValue(ExpressionsHelper.TypeFullName(variableName)).Contains("DateTime"));
 }
Пример #7
0
 private static bool IsArray(string variableName)
 {
     return("\"Array\"" == DebuggerHelper.GetValue(ExpressionsHelper.BaseTypeName(variableName)));
 }
Пример #8
0
 private static bool IsList(string variableName)
 {
     return("\"List`1\"" == DebuggerHelper.GetValue(ExpressionsHelper.TypeName(variableName)));
 }
Пример #9
0
 private static bool IsString(string variableName)
 {
     return("\"System.String\"" == DebuggerHelper.GetValue(ExpressionsHelper.TypeFullName(variableName)));
 }
Пример #10
0
 private static bool IsClass(string variableName)
 {
     return("true" == DebuggerHelper.GetValue(ExpressionsHelper.IsClass(variableName)).ToLower());
 }
        public static string GetMembersInitialization(string variableName, int membersCount)
        {
            var membersStringBuilder = new StringBuilder();

            Indentation.Level++;

            for (int i = 0; i < membersCount; i++)
            {
                if (membersStringBuilder.Length > 0)
                {
                    membersStringBuilder.AppendLine(",");
                }

                var memberInitialization = ObjectInitializationFactory.CreateObjectInitialization(ExpressionsHelper.Item(variableName, i));

                membersStringBuilder.Append(string.Concat(Indentation.ToString(), memberInitialization.Initialization));
            }

            Indentation.Level--;

            return(membersStringBuilder.ToString());
        }