首页 新闻 会员 周边

asp.net

0
[已解决问题] 解决于 2016-06-04 22:37

public static object Eval(object container, string expression) 

    if (expression == null) 
    { 
        throw new ArgumentNullException("expression"); 
    } 
    expression = expression.Trim(); 
    if (expression.Length == 0) 
    { 
        throw new ArgumentNullException("expression"); 
    } 
    if (container == null) 
    { 
        return null; 
    } 
    string[] expressionParts = expression.Split(expressionPartSeparator); 
    return Eval(container, expressionParts); 
}
 
private static object Eval(object container, string[] expressionParts) 

    object propertyValue = container; 
    for (int i = 0; (i < expressionParts.Length) && (propertyValue != null); i++) 
    { 
        string propName = expressionParts[i]; 
        if (propName.IndexOfAny(indexExprStartChars) < 0) 
        { 
            propertyValue = GetPropertyValue(propertyValue, propName); 
        } 
        else
        { 
            propertyValue = GetIndexedPropertyValue(propertyValue, propName); 
        } 
    } 
    return propertyValue; 
}
 
public static string Eval(object container, string expression, string format) 

    object obj2 = Eval(container, expression); 
    if ((obj2 == null) || (obj2 == DBNull.Value)) 
    { 
        return string.Empty; 
    } 
    if (string.IsNullOrEmpty(format)) 
    { 
        return obj2.ToString(); 
    } 
    return string.Format(format, obj2); 
}
 
public static object GetDataItem(object container) 

    bool flag; 
    return GetDataItem(container, out flag); 
}


public virtual void DataBind() 

    this.DataBind(true); 

protected virtual void DataBind(bool raiseOnDataBinding) 

    bool flag = false; 
    if (this.IsBindingContainer)
    { 
        bool flag2; 
        object dataItem = DataBinder.GetDataItem(this, out flag2);
        if (flag2 && (this.Page != null))
        { 
            this.Page.PushDataBindingContext(dataItem);) 
            flag = true; 
        } 
    } 
    try
    { 
        if (raiseOnDataBinding) 
        { 
            this.OnDataBinding(EventArgs.Empty); 
        } 
        this.DataBindChildren();
    } 
    finally
    { 
        if (flag) 
        { 
            this.Page.PopDataBindingContext();
        } 
    } 

C# code?
1
 


谁能给我详细解释一下上面代码的意思

博学多思的主页 博学多思 | 初学一级 | 园豆:76
提问于:2015-01-23 08:08
< >
分享
最佳答案
0

0.0

奖励园豆:5
晴天玉宇 | 菜鸟二级 |园豆:207 | 2015-10-17 11:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册