後來建立一個新的MVC專案也是同樣的問題
結果原因似乎是出現在"小紅傘"身上,移除後就正常了
之後再將"小紅傘"重新安裝回去
環境:vs2010, mvc2 web 應用程式
private void SetProviderConnectionString(string connectionString)
{
// Set private property of Membership, Role and Profile providers.
//Do not try this at home!!
FieldInfo connectionStringField = Membership.Provider.GetType().GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
if (connectionStringField != null)
connectionStringField.SetValue(Membership.Provider, connectionString);
FieldInfo roleField = Roles.Provider.GetType().GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
if (roleField != null)
roleField.SetValue(Roles.Provider, connectionString);
FieldInfo profileField = ProfileManager.Provider.GetType().GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
if (profileField != null)
profileField.SetValue(ProfileManager.Provider, connectionString);
}
int i = (int)123.456;
ClassA x = new ClassA();
ClassB y = (ClassB)x;
class ClassA
{
public int Amount = 0;
public ClassA(int amount) { this.Amount = amount; }
}
class ClassB
{
public string Content = string.Empty;
public ClassB(string content) { this.Content = content;}
}
public static implicit operator ClassB(ClassA obj)
{
int amount = 0;
if (obj.Amount > 26 || obj.Amount < 0)
throw new Exception("out of range");
else
amount = obj.Amount;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < amount; i++)
sb.Append((char)(67 + i));
ClassB result = new ClassB(sb.ToString());
return result;
}
static void Main(string[] args)
{
ClassA a = Class(10);
ClassB b = (ClassB)a;
Console.WriteLine(b.Content);
Console.Read();
}
<pre class="brush: language;">
// 欲顯示的程式碼
</pre>
語言名稱 | 對應名稱 |
ActionScript3 | as3, actionscript3 |
Bash/shell | bash, shell |
ColdFusion | cf, coldfusion |
C# | c-sharp, csharp |
C++ | cpp, c |
CSS | css |
Delphi | delphi, pas, pascal |
Diff | diff, patch |
Erlang | erl, erlang |
Groovy | groovy |
JavaScript | js, jscript, javascript |
Java | java |
JavaFX | jfx, javafx |
Perl | perl, pl |
PHP | php |
Plain Text> | plain, text |
PowerShell | ps, powershell |
Python | py, python |
Ruby | rails, ror, ruby |
Scala | scala |
SQL | sql |
Visual Basic | vb, vbnet |
XML | xml, xhtml, xslt, html, xhtml |