コード例 #1
0
        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());
 }
コード例 #11
0
        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());
        }