Remove implicit conversion from LocalizedString to string

Having both way implicit conversion tend to confuse the C# compiler
and really question the existence of the specific type in the first place.

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-06-03 16:57:44 -07:00
parent 9b57d00d13
commit 2a41a3dedf
3 changed files with 4 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ namespace Orchard.Commands {
propertyInfo.SetValue(this, stringValue, null);
}
else {
throw new InvalidOperationException(T("No property named {0} found of type bool, int or string.", commandSwitch));
throw new InvalidOperationException(T("No property named {0} found of type bool, int or string.", commandSwitch).ToString());
}
}
}
@@ -55,7 +55,7 @@ namespace Orchard.Commands {
CheckMethodForSwitches(context.CommandDescriptor.MethodInfo, context.Switches);
object[] invokeParameters = GetInvokeParametersForMethod(context.CommandDescriptor.MethodInfo, (context.Arguments ?? Enumerable.Empty<string>()).ToArray());
if (invokeParameters == null) {
throw new InvalidOperationException(T("Command arguments don't match"));
throw new InvalidOperationException(T("Command arguments don't match").ToString());
}
this.Context = context;
@@ -105,7 +105,7 @@ namespace Orchard.Commands {
}
foreach (var commandSwitch in switches.Keys) {
if (!supportedSwitches.Contains(commandSwitch)) {
throw new InvalidOperationException(T("Method {0} does not support switch {1}.", methodInfo.Name, commandSwitch));
throw new InvalidOperationException(T("Method {0} does not support switch {1}.", methodInfo.Name, commandSwitch).ToString());
}
}
}

View File

@@ -53,7 +53,7 @@ namespace Orchard.Environment.Extensions {
private Feature LoadFeature(FeatureDescriptor featureDescriptor) {
var featureName = featureDescriptor.Name;
string extensionName = GetExtensionForFeature(featureName);
if (extensionName == null) throw new ArgumentException(T("Feature {0} was not found in any of the installed extensions", featureName));
if (extensionName == null) throw new ArgumentException(T("Feature {0} was not found in any of the installed extensions", featureName).ToString());
var extension = BuildActiveExtensions().Where(x => x.Descriptor.Name == extensionName).FirstOrDefault();
if (extension == null) throw new InvalidOperationException(T("Extension ") + extensionName + T(" is not active"));

View File

@@ -16,10 +16,6 @@ namespace Orchard.Localization {
return _localized;
}
public static implicit operator string(LocalizedString x) {
return x._localized;
}
public override int GetHashCode() {
var hashCode = 0;
if (_localized != null)