这很奇怪,但我一直在寻找一个没有可接受结果的工具来找到一个工具来突出显示,验证和折叠JSON文件数据,以便在visual studio中手动编辑.我甚至还没有梦想过IntelliSense.它是如此流行的格式,没有机会编辑IDE?没有插件或本机支持.试图将scriptteditior连接到json没有任何效果.
我能够以方便的方式手动编辑json的最接近的东西是http://jsoneditoronline.org/的 Google Chrome扩展,它允许我从本地磁盘打开和保存文件.
我也尝试过搜索Visual Studio 2010的解决方案 - 但是也找不到这个版本.
有人知道如何在VS IDE中使用此功能吗?
H.我正在尝试构建linq查询,动态生成动态发送字段的自定义排序查询.
我是建构逻辑
Expression<Func<string, int>> SpaceStringSortExpression = (a) => a.StartsWith(" ") ? 2 : 1;
Run Code Online (Sandbox Code Playgroud)
此代码(SpaceStringSortExpression.ToString())的签名是"a => IIF(a.StartsWith(\"\"),2,1)"
为了做到这一点,我做了:
ParameterExpression parameter = Expression.Parameter(typeof(TSource), "p1");
Expression orderByProperty = Expression.Property(parameter, propertyName);
ConstantExpression c = Expression.Constant(" ", typeof(string));
MethodInfo mi = typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) });
Expression call = Expression.Call(orderByProperty, mi, c);
Expression<Func<TSource, bool>> lambda = Expression.Lambda<Func<TSource, bool>>(call, parameter);
ConditionalExpression t = Expression.IfThenElse(call, Expression.Constant(2), Expression.Constant(1));
//t.tostring() - IIF(p1.Login.StartsWith(" "), 2, 1)
LambdaExpression callt = Expression.Lambda(t, new[] { parameter });
//callt.tostring() = p1 => …Run Code Online (Sandbox Code Playgroud)