|
|
|
@ -63,7 +63,7 @@ namespace ICSharpCode.Decompiler
@@ -63,7 +63,7 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
liftNullables = false; |
|
|
|
|
yieldReturn = false; |
|
|
|
|
useImplicitMethodGroupConversion = false; |
|
|
|
|
genericTypeInstantiation = false; |
|
|
|
|
useObjectCreationOfGenericTypeParameter = false; |
|
|
|
|
} |
|
|
|
|
if (languageVersion < CSharp.LanguageVersion.CSharp3) |
|
|
|
|
{ |
|
|
|
@ -211,7 +211,7 @@ namespace ICSharpCode.Decompiler
@@ -211,7 +211,7 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
if (anonymousTypes || objectCollectionInitializers || automaticProperties |
|
|
|
|
|| queryExpressions || expressionTrees) |
|
|
|
|
return CSharp.LanguageVersion.CSharp3; |
|
|
|
|
if (anonymousMethods || liftNullables || yieldReturn || useImplicitMethodGroupConversion || genericTypeInstantiation) |
|
|
|
|
if (anonymousMethods || liftNullables || yieldReturn || useImplicitMethodGroupConversion || useObjectCreationOfGenericTypeParameter) |
|
|
|
|
return CSharp.LanguageVersion.CSharp2; |
|
|
|
|
return CSharp.LanguageVersion.CSharp1; |
|
|
|
|
} |
|
|
|
@ -987,21 +987,21 @@ namespace ICSharpCode.Decompiler
@@ -987,21 +987,21 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool genericTypeInstantiation = true; |
|
|
|
|
bool useObjectCreationOfGenericTypeParameter = true; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets/Sets whether to use generic type instantiation for generic types with <c>new()</c> constraint.
|
|
|
|
|
/// Gets/Sets whether to use object creation expressions for generic types with <c>new()</c> constraint.
|
|
|
|
|
/// true: <c>T t = new T();</c>
|
|
|
|
|
/// false: <c>T t = Activator.CreateInstance<T>()</c>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Category("C# 2.0 / VS 2005")] |
|
|
|
|
[Description("DecompilerSettings.GenericTypeInstantiation")] |
|
|
|
|
public bool GenericTypeInstantiation { |
|
|
|
|
get { return genericTypeInstantiation; } |
|
|
|
|
[Description("DecompilerSettings.UseObjectCreationOfGenericTypeParameter")] |
|
|
|
|
public bool UseObjectCreationOfGenericTypeParameter { |
|
|
|
|
get { return useObjectCreationOfGenericTypeParameter; } |
|
|
|
|
set { |
|
|
|
|
if (genericTypeInstantiation != value) |
|
|
|
|
if (useObjectCreationOfGenericTypeParameter != value) |
|
|
|
|
{ |
|
|
|
|
genericTypeInstantiation = value; |
|
|
|
|
useObjectCreationOfGenericTypeParameter = value; |
|
|
|
|
OnPropertyChanged(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|