[英]Umbraco member properties
I got the below error,我收到以下错误,
Cannot apply indexing with [] to an expression of type 'IEnumerable'
无法使用 [] 将索引应用于“IEnumerable”类型的表达式
This is my code,这是我的代码,
var member = Members.GetCurrentMember();
if (member!=null) {
string redirectURL = (member.Properties["postSignInUrl"].Value.ToString() != null ) ? member.Properties["postSignInUrl"].Value.ToString() : "";
Response.Redirect(redirectURL);
I am trying to get the members property value of postSignInUrl which is custom我正在尝试获取自定义的 postSignInUrl 的成员属性值
This is not a Umbraco issue per se.这本身不是 Umbraco 问题。 Its hard to tell what GetCurrentMember() returns as its a var here.
很难说 GetCurrentMember() 在这里返回的 var 是什么。
IEnumerable
doesnot include an Indexer . IEnumerable
不包括Indexer 。 IList include Indexing. IList包括索引。 If the method returns an
IList<T>
, then make a reference of type IList<T>
else use enumerable.ElementAt(index)
.如果该方法返回
IList<T>
,则进行IList<T>
类型的引用,否则使用enumerable.ElementAt(index)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.