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)); }
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); }
private static bool IsPropertyWritable(string variableName, string propertyName) { return("true" == DebuggerHelper.GetValue(ExpressionsHelper.CanWrite(variableName, propertyName)).ToLower()); }
private static bool IsFieldPublic(string variableName, string propertyName) { return("false" == DebuggerHelper.GetValue(ExpressionsHelper.IsInitOnly(variableName, propertyName)).ToLower()); }
private static bool IsDictionary(string variableName) { return("\"Dictionary`2\"" == DebuggerHelper.GetValue(ExpressionsHelper.TypeName(variableName))); }
private static bool IsDatetime(string variableName) { //pourrait être plus précis return(DebuggerHelper.GetValue(ExpressionsHelper.TypeFullName(variableName)).Contains("DateTime")); }
private static bool IsArray(string variableName) { return("\"Array\"" == DebuggerHelper.GetValue(ExpressionsHelper.BaseTypeName(variableName))); }
private static bool IsList(string variableName) { return("\"List`1\"" == DebuggerHelper.GetValue(ExpressionsHelper.TypeName(variableName))); }
private static bool IsString(string variableName) { return("\"System.String\"" == DebuggerHelper.GetValue(ExpressionsHelper.TypeFullName(variableName))); }
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()); }