if(isupper(i))
out += (i + key[j] - 2*'A') % 26 + 'A';
else
out += (i + key[j] - 2*'A') % 26 + 'a';
out += ((i - 'A') + (key[j] - 'A')) % 26 + 'A';
out += ((i - 'a') + (key[j] - 'A')) % 26 + 'a';
class Arrays<T>
{
public T GetValue(int k)
{
if (k < 0 || k > array.Length)
throw new IndexOutOfRanfeException();
return (array[k]);
}
class Arrays<T> where T : class
{
public T GetValue(int k)
{
if (k < 0 || k > array.Length)
return null;
return (array[k]);
}
class Arrays<T>
{
public T GetValue(int k)
{
if (k < 0 || k > array.Length)
return default(T);
return (array[k]);
}
ManagementObjectSearcher searcher
= new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");
// или new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
string graphicsCard = string.Empty;
foreach (ManagementObject mo in searcher.Get())
{
foreach (PropertyData property in mo.Properties)
{
if (property.Name == "Description")
{
graphicsCard = property.Value.ToString();
}
}
}
public static void Main()
{
while(true)
{
Thread.Sleep(100);
}
}
var xEl = XElement.Parse("<div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal\">Hello word</div>");
Console.WriteLine((string)xEl);
var xDoc = XDocument.Parse("<div><div class='c1'>c1</div><div class='c2'>c2</div><div class='c3'>c3</div></div>");
string xPath = "//div[@class='c1']";
foreach (var xElement in xDoc.XPathSelectElements(xPath))
{
Console.WriteLine((string)xElement);
}
using System;
using System.Text;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
Console.WriteLine(string.Join("|", Parse("Мама,\"мыла, блин\", раму,\"мама, мыла \"\"раму\"\"\",конец")));
}
public enum StateEnum{Start, StartQuot, Inline, InlineQuot}
public static IEnumerable<string> Parse(string str)
{
var state = StateEnum.Start;
var sb = new StringBuilder();
foreach(var ch in str)
{
switch(ch)
{
case '"':
switch(state)
{
case StateEnum.Start:
state = StateEnum.StartQuot;
continue;
case StateEnum.StartQuot:
case StateEnum.InlineQuot:
state = StateEnum.Inline;
sb.Append('"');
continue;
case StateEnum.Inline:
state = StateEnum.InlineQuot;
continue;
}
break;
case ',':
switch(state)
{
case StateEnum.Start:
case StateEnum.InlineQuot:
yield return sb.ToString();
sb.Clear();
state = StateEnum.Start;
continue;
case StateEnum.StartQuot:
case StateEnum.Inline:
sb.Append(',');
state = StateEnum.Inline;
continue;
}
goto default;
default:
sb.Append(ch);
break;
}
}
yield return sb.ToString();
}
}