- 1
News news = new News();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+143.8
News news = new News();
+112.1
public IEnumerator GetEnumerator()
{
for (int CurID = 0; CurID < (controls.Count + animations.Count) / 2; CurID++)
{
KeyValuePair<Control, Animation> kvp = new KeyValuePair<Control, Animation>(controls[CurID], animations[CurID]);
yield return kvp;
}
}
Писал я код, и задумался. А когда очнулся - уже было это.
ЗЫ. controls.Count == animations.Count
+142.6
myDataSet.Tables[0].DataSet.GetXml();
need XML Data Source from XML for making dynamic ASP:Menu
This code makes DataSource as a Parent element and elements from sql as a Children
I need Parent Elements only from my sql. To make it like a Horizontal TabSet . . .
+109.4
//Dictionary used to check if eventValues are unique
Dictionary<string, string> uniqueEventValues = new Dictionary<string, string>();
//... заполняем коллекцию
try {
uniqueEventValues.Add(eventValue, "X");
}
catch (Exception ex) {
if (ex.Message.Equals("An item with the same key has already been added.")) {
msgAddEventParams.Text = "EventValues must be unique. " + eventValue + " is duplicate.";
msgAddEventParams.Visible = true;
return;
}
}
мы не ищем легких путей!
+144.5
private static List<KeyValuePair<string, string>> m_destinationUrlByRole = new List<KeyValuePair<string,string>>();
...
дальше по коду
foreach(KeyValuePair<string, string> destination in m_destinationUrlByRole)
{
...
}
Если честно, то долго пытался понять сакральный смысл типа приватного поля...
+142.6
using System;
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;
using System.Runtime.InteropServices;
namespace nCdy
{
/// <summary>
/// Description of Win32API.
/// </summary>
public static class Win32API
{
[ Flags ]
public enum AllocationType
{
| Commit = 0x1000
}
[ Flags ]
public enum ProcessAccess : int
{
| VMOperation = 0x8
| VMRead = 0x10
| VMWrite = 0x20
}
[ Flags ]
public enum MemoryProtection
{
| ReadWrite = 0x04
}
//[StructLayout(LayoutKind.Sequential)]
public struct LUID {
internal LowPart : uint;
internal HighPart : uint;
}
//[StructLayout(LayoutKind.Sequential)]
public struct TOKEN_PRIVILEGES
{
public PrivilegeCount : UInt32;
public Luid : LUID;
public Attributes : UInt32;
}
public struct MOUSEINPUT
{
dx : int;
dy : int;
mouseData : int;
dwFlags : int;
time : int;
dwExtraInfo : IntPtr;
}
public struct KEYBDINPUT
{
public mutable wVk : char ;
public wScan : short ;
public dwFlags : int ;
public time : int ;
public dwExtraInfo : IntPtr ;
}
public struct HARDWAREINPUT
{
uMsg : int ;
wParamL : short ;
wParamH : short ;
}
[StructLayout(LayoutKind.Explicit)]
public struct INPUT
{
[FieldOffset(0)]
public mutable typefield : int ;
[FieldOffset(4)]
mi : MOUSEINPUT;
[FieldOffset(4)]
public mutable ki : KEYBDINPUT;
[FieldOffset(4)]
hi : HARDWAREINPUT;
}
[DllImport("user32.dll")]
public static extern keybd_event(
bVk : byte,
bScan : byte,
dwFlags : uint,
dwExtraInfo : UIntPtr) : void ;
[DllImport("user32.dll")]
ООП
+102.3
string statStr = string.Format("execution statistics:" + Environment.NewLine
+ "\t{0}" + Environment.NewLine + "\t{1}",
_requestUrl,
execStat);
+135.2
protected void DuplicateFilterNameValidator(object source, ServerValidateEventArgs args)
{
string _filterName = FilterName.Text;
SqlCommand command = new SqlCommand();
SqlDataReader filterNameReader = null;
try
{
SqlConnection connection = new SqlConnection(strConn);
connection.Open();
command.CommandText = "EventNotificationFilterSelectByName";
command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@filterName", _filterName));
filterNameReader = command.ExecuteReader();
if (filterNameReader.HasRows)
{
args.IsValid = false;
}
if ((connection != null) & (connection.State == ConnectionState.Open))
{
connection.Close();
}
}
catch (Exception e)
{
_log.Error(e);
}
}
omg...
+134.7
private bool localGlobal;
//...
string filterActionOrder = FilterActionOrder.Text;
//For sorting purpose, substract .5 to the ActionOrder to ensure
//the order specified takes precedence
double filterActionOrderTemp = Double.Parse(filterActionOrder) - .5;
filterActionOrder = filterActionOrderTemp.ToString();
без комментариев :)
+130.9
def TryToFix() : void
{
def RozoviySlon() : bool
{
System.Diagnostics.Process.Start("http://rsdn.ru/Users/73.aspx");
if("solution"=="Весёлый слоник не поднимает настроение ?")
false
else
true
}
unless ( (if ( RozoviySlon() ) "Розовый слон"
else "Всё хорошо :D") == "Всё хорошо :D" )
while( RozoviySlon() )
MessageBox.Show("ААААААААААААААААААА !!!");
}
try
{
Application.Run(nCdy.nForm());
}
catch
{
| e is Exception => TryToFix();
}
Весёлый слоник не поднимает настроение ?