To:3tzjq Dim cookie As Object = CurrentContext.Request.Cookies(CookieName()) If (Not cookie Is Nothing AndAlso cookie.Value <> "") Then这段代码~加颜色部分整成C#是啥样的啊,谢谢
貌似楼主还没解决。 Dim cookie As Object = CurrentContext.Request.Cookies(CookieName()) if cookie Is Nothing then return ...dim value as object = cookie.GetType().GetProperty("Value").GetValue(cookie, nothing) if value is nothing then value = string.emptyIf string.isnullorempty(value.ToString())=false Then ...
一般情况下,我们都要用转换函数将Object类转换成具体的类型,
再进行操作的
System.Reflection.PropertyInfo pi = obj.GetType().GetProperty("Value");
return pi.GetValue(obj, null);
pi.GetValue(obj, null)返回的这个是什么类型啊
If (Not cookie Is Nothing AndAlso cookie.Value <> "") Then这段代码~加颜色部分整成C#是啥样的啊,谢谢
Dim cookie As Object = CurrentContext.Request.Cookies(CookieName())
if cookie Is Nothing then return ...dim value as object = cookie.GetType().GetProperty("Value").GetValue(cookie, nothing)
if value is nothing then value = string.emptyIf string.isnullorempty(value.ToString())=false Then
...