public static GetFullName ( |
||
t | ||
Résultat | string |
private CodeExpression ConvertArrayToCodeExpression(object o) { CSharpCodeProvider provider = new CSharpCodeProvider(); StringBuilder builder = new StringBuilder(); IEnumerator enumerator = ((IEnumerable)o).GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; if (builder.Length != 0) { builder.Append(','); } StringWriter writer = new StringWriter(); provider.GenerateCodeFromExpression(this.ConvertSingleValueToCodeExpression(current), writer, new CodeGeneratorOptions()); builder.AppendFormat(writer.ToString(), new object[0]); writer.Close(); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } return(new CodeSnippetExpression($"new {SerializedType.GetFullName(this.type)} {{ {builder} }}")); }
private CodeExpression ConvertArrayToCodeExpression(object o) { CSharpCodeProvider cSharpCodeProvider = new CSharpCodeProvider(); StringBuilder stringBuilder = new StringBuilder(); foreach (object current in ((IEnumerable)o)) { if (stringBuilder.Length != 0) { stringBuilder.Append(','); } StringWriter stringWriter = new StringWriter(); cSharpCodeProvider.GenerateCodeFromExpression(this.ConvertSingleValueToCodeExpression(current), stringWriter, new CodeGeneratorOptions()); stringBuilder.AppendFormat(stringWriter.ToString(), new object[0]); stringWriter.Close(); } return(new CodeSnippetExpression(string.Format("new {0} {{ {1} }}", SerializedType.GetFullName(this.type), stringBuilder))); }