2012-11-17 51 views
1

我想用屬性擴展ClaimsPrincipal類。我想添加屬性IsAuthenticated,它將基本上從已經存在的Identity屬性返回IsAuthenticated。到目前爲止,我把它作爲一個函數來完成:用IsAuthenticated屬性擴展ClaimsPrincipal類

public static bool IsAuthenticated(this ClaimsPrincipal principal) 
    { 
     return principal.Identity.IsAuthenticated; 
    } 

我想將其轉換爲屬性。

+1

雖然達網絡是不支持性能擴展,對於一些見解:在C#屬性的易擴展](http://www.codeproject.com/Articles/386911/Csharp-Easy-Extension-Properties) – bonCodigo

回答

1

C#或VB.NET不支持擴展屬性