The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."
Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.
On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.
void MyMethod()
{
Func<int> pamar1 = () => 1 * 2;
Func<int> pamar2 = () => 3 * 4;
Func<int> pamar3 = () => 5 * 6;
for (var i = 0; i < 10; ++i)
{
DoMethod(pamar1, pamar2, pamar3);
}
}
void DoMethod(Func<int> pamar1, Func<int> pamar2, Func<int> pamar3)
{
Console.WriteLine(pamar1() * pamar2() * pamar3());
}
static void Main(string[] args)
{
var criteria = new Expression<Func<string, bool>>[]
{
str => str.Contains("дом"),
str => str.EndsWith("!"),
str => str.Substring(0, 1).ToUpper().Equals(str.Substring(0, 1)),
};
var complexCriterion = "1 | (2 & 3)";
var ep = new ExprParser();
LambdaExpression lambda = ep.Parse("(string str) => " + BuildComplexCriterion(complexCriterion, criteria));
var result = ep.Run(lambda, "дом");
}
static string BuildComplexCriterion(string complexCriterion, Expression<Func<string, bool>>[] criteria)
{
for (var i = 0; i < criteria.Length; ++i)
{
complexCriterion = complexCriterion.Replace((i + 1).ToString(), criteria[i].Body.ToString());
}
return complexCriterion;
}
HttpRequest.QueryString
The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."
Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.
On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.
MethodInfo mi1 = typeof(Double).GetMethod("TryParse",
BindingFlags.Static | BindingFlags.Public,
null,
new Type[] { typeof(string), typeof(Double).MakeByRefType() },
null);
class TextBoxWithPlaceholder : TextBox
{
public string Placeholder { get; set; }
protected override void OnCreateControl()
{
base.OnCreateControl();
if (!DesignMode)
{
Text = Placeholder;
}
}
protected override void OnLostFocus(EventArgs e)
{
base.OnLostFocus(e);
if (Text.Equals(string.Empty))
{
Text = Placeholder;
}
}
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
if (Text.Equals(Placeholder))
{
Text = string.Empty;
}
}
}
if (textbox1.Text == string.Empty)
bool ValidateModel()
{
var validationContext = new ValidationContext(Bank, null, null);
var validationResults = new List<ValidationResult>();
Validator.TryValidateObject(Bank, validationContext, validationResults);
if (validationResults.Any())
{
foreach (var validationResult in validationResults)
{
ShowError(validationResult.MemberNames.First(), validationResult.ErrorMessage);
}
return false;
}
else
{
return true;
}
}
private void dropDownClosedYearMonth(object sender, EventArgs e)
{
btnPrint.Click += new EventHandler(btnPrintClick);
}