HttpRequest.QueryString
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);
}
IEnumerable<Point> GetPoints(int points) // points - количество вершин
{
return Enumerable.Range(0, points)
.Select(i => 2 * i * Math.PI / points)
.Select(arg => new Point
{
X = Math.Cos(arg),
Y = Math.Sin(arg)
});
}
struct Point
{
public double X;
public double Y;
}
public class MyNumeric<T> where T : struct, IComparable<T>, IEquatable<T>, IConvertible
{
public static readonly T MaxValue = ReadStaticField("MaxValue");
public static readonly T MinValue = ReadStaticField("MinValue");
private static T ReadStaticField(string name)
{
FieldInfo field = typeof(T).GetField(name, BindingFlags.Public | BindingFlags.Static);
if (field == null)
{
throw new InvalidOperationException("Нечисловой тип: " + typeof(T).Name);
}
return (T)field.GetValue(null);
}
}
Console.WriteLine(MyNumeric<int>.MaxValue);
Console.WriteLine(MyNumeric<float>.MinValue);
var xml = XDocument.Parse(
@"<?xml version='1.0' encoding='utf-8'?>
<!-- This is a SCORM 1.2 manifest file, created 9/1/2014 1:52:58 PM by semina using CourseLab 140211 -->
<manifest xmlns='http://www.imsproject.org/xsd/imscp_rootv1p1p2' xmlns:adlcp='http://www.adlnet.org/xsd/adlcp_rootv1p2' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation=' http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd' identifier='MANIFEST-5D060C55_4EC0_4E49_8D2F_F5C934FFEDAD' version='1.0'>
<title>Технолог подсистемы САДД БР. Работа с модулем «Справочники»</title>
<item identifier='im_1' identifierref='RES1' parameters='?width=1152&height=920'>
<title>Информационный материал</title>
</item>
<item identifier='im_1' identifierref='RES1' parameters='?width=1152&height=920'>
<title>Информационный материал</title>
</item>
</manifest>");
var ns = xml.Root.GetDefaultNamespace();
foreach (var element in xml.Root.Descendants().Where(e => e.Name == ns + "item"))
{
var last = element.Elements().Last();
if (last.Name == ns + "title")
{
last.AddAfterSelf(
new XElement("track",
new XAttribute("id", ""),
new XAttribute("genre", "Break Beat")));
}
}