bonusFunction b = Bonus.Kattenacho;
Type methodHost = b.Method.DeclaringType;
string methodName = b.Method.Name;
Console.WriteLine("{0} -> {1}", methodHost.FullName, methodName);
private static readonly Encoding Windows1251Encoding = Encoding.GetEncoding(1251);
static string FromCyrillicStringArray(string[] values)
{
var bytes = new byte[values.Length];
for (var i = 0; i < values.Length; i++)
bytes[i] = Convert.ToByte(values[i]);
return Windows1251Encoding.GetString(bytes);
}
...
var codes = new[] { "207", "192", "207", "192" };
Console.WriteLine(FromCyrillicStringArray(codes) == "ПАПА"); // true
static bool TryGetCharIndices(char element, out int x, out int y)
{
for (var i = 0; i < URusa2.GetLength(0); i++)
{
for (var j = 0; j < URusa2.GetLength(1); j++)
{
if (URusa2[i, j] == element)
{
y = i;
x = j;
return true;
}
}
}
x = -1;
y = -1;
return false;
}
pole_zapol(null, null);
var classes = new[]
{
new
{
Name = "System.String",
AssemblyName = "mscorlib",
Args = new object[] { "Single argument".ToCharArray() }
},
new
{
Name = "Newtonsoft.Json.Linq.JObject",
AssemblyName = "Newtonsoft.Json",
Args = new object[] {}
},
new
{
Name = "System.IO.FileInfo",
AssemblyName = "mscorlib",
Args = new object[] { @"C:\Windows\System32\cmd.exe" }
}
};
var instances = classes
.Select(i =>
{
var assembly = Assembly.Load(i.AssemblyName);
var type = assembly.GetType(i.Name);
var instance = Activator.CreateInstance(type, i.Args);
return instance;
})
.ToArray();
class Program
{
static void Main(string[] args)
{
Console.InputEncoding = Console.OutputEncoding = Encoding.GetEncoding(@"Cyrillic");
var letters = Console.ReadLine().ToCharArray(); // Введи весь алфавит в одну строчку
var wordLength = int.Parse(Console.ReadLine()); // Введи размер слова
var word = new char[wordLength];
var totalWordsCount = 1;
for (var i = 0; i < wordLength; i++)
totalWordsCount *= letters.Length;
for (var i = 0; i < totalWordsCount; i++)
{
var accum = i;
for (var j = word.Length - 1; j >= 0; j--)
{
word[j] = letters[accum % letters.Length];
accum /= letters.Length;
}
Console.WriteLine(new string(word));
}
Console.ReadKey();
}
}
var dateFromString = txtSelectByDate1.Text;
var dateToString = txtSelectByDate2.Text;
if (!string.IsNullOrEmpty(dateFromString) && !string.IsNullOrEmpty(dateToString))
{
var dateFrom = Convert.ToDateTime(dateFromString).ToString("yyyy-MM-dd");
var dateTo = Convert.ToDateTime(dateToString).ToString("yyyy-MM-dd");
var query = string.Format("Select * from Purchase where P_Date >= '{0}' and P_Date <= '{1}'", dateFrom, dateTo);
var command = new SqlCommand(query, cn);
var adapter = new SqlDataAdapter(command);
var table = new DataTable();
adapter.Fill(table);
gvPurchase.DataSourceID = null;
gvPurchase.DataSource = table;
}