IEnumerable<object> GetResources(System.Reflection.Assembly inAssembly, System.Globalization.CultureInfo inCultureInfo) =>
((System.Resources.ResourceManager)inAssembly
.GetTypes()
.FirstOrDefault(type => type.Name == "Resources")
.GetProperty("ResourceManager", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)
.GetValue(null, null))
.GetResourceSet(inCultureInfo, true, true)
.OfType<System.Collections.DictionaryEntry>()
.Select(item => item.Value);
var resources = GetResources(System.Reflection.Assembly.GetCallingAssembly(), System.Globalization.CultureInfo.InvariantCulture);
public IEnumerable<string> GetPhotoUrl() =>
Api
.Wall
.Get(new WallGetParams
{
Domain = "lol.community",
Count = 2
})
.WallPosts
.Select(item => item.Attachments.FirstOfDefault()?.Instance)
.OfType<Photo>()
.Select(item => item.Sizes.FirstOfDefault()?.Url.AbsoluteUrl.ToString());
public class DrawingAreaControl : UserControl
{
public DrawingAreaControl()
{
DoubleBuffered = true;
transform = new Matrix();
}
public Matrix transform { get; set; }
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
e.Graphics.Transform = transform;
base.OnPaint(e);
}
const float SCALE_MUL = 1.05f;
protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);
var matrixOrder = MatrixOrder.Append;
var K = e.Delta > 0 ? SCALE_MUL : 1 / SCALE_MUL;
transform.Multiply(new Matrix(1, 0, 0, 1, -e.Location.X, -e.Location.Y), matrixOrder);
transform.Multiply(new Matrix(K, 0, 0, K, 0, 0), matrixOrder);
transform.Multiply(new Matrix(1, 0, 0, 1, e.Location.X, e.Location.Y), matrixOrder);
Invalidate();
}
}
[XmlIgnore]
public bool MyValue { get; set; }
/// <summary>Get a value purely for serialization purposes</summary>
[XmlElement("MyValue")]
public string MyValueSerialize
{
get { return this.MyValue ? "1" : "0" }
set { this.MyValue = XmlConvert.ToBoolean(value); }
}
using System;
using System.Collections.Generic;
using System.Linq;
namespace throughOneKill
{
class Program
{
static void Main(string[] args)
{
int N = 10;
var list = new LinkedList<int>(Enumerable.Range(1, N));
Console.WriteLine(string.Join(" ", list));
var currentItem = list.First;
while (list.Count != 1)
{
list.Remove(currentItem.Next ?? list.First);
currentItem = currentItem.Next ?? list.First;
}
Console.WriteLine(list.First.Value);
Console.ReadKey();
}
}
}