- 1
- 2
- 3
- 4
if (value is Int32)
{
Int32 prio = Int32.Parse(value.ToString());
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+6
if (value is Int32)
{
Int32 prio = Int32.Parse(value.ToString());
}
+2
string[] array=new string[10];
array[0] = "?";
array[1] = "?";
array[2] = "?";
array[3] = "?";
array[4] = "?";
array[5] = "?";
array[6] = "?";
array[7] = "?";
array[8] = "?";
....
if (DS.Tables[0].Rows[i][3].ToString() == "1")
{
checkBox20.Checked = true;
}
if (DS.Tables[0].Rows[i][4].ToString() == "1")
{
checkBox23.Checked = true;
}
if (DS.Tables[0].Rows[i][5].ToString() == "1")
{
checkBox22.Checked = true;
}
if (DS.Tables[0].Rows[i][6].ToString() == "1")
{
checkBox25.Checked = true;
}
if (DS.Tables[0].Rows[i][7].ToString() == "1")
{
checkBox24.Checked = true;
}
if (DS.Tables[0].Rows[i][8].ToString() == "1")
{
checkBox27.Checked = true;
}
if (DS.Tables[0].Rows[i][9].ToString() == "1")
{
checkBox11.Checked = true;
}
...
if (checkBox17.Checked)
{
array[0] = "application/";
}
if (checkBox18.Checked)
{
array[1] = "audio/";
}
if (checkBox21.Checked)
{
array[2] = "example/";
}
if (checkBox20.Checked)
{
array[3] = "image/";
}
if (checkBox23.Checked)
{
array[4] = "message/";
}
if (checkBox22.Checked)
{
array[5] = "model/";
}
if (checkBox25.Checked)
{
array[6] = "multipart/";
}
if (checkBox24.Checked)
{
array[7] = "text/";
}
if (checkBox27.Checked)
Дали на рецензию одну научную работу...
+3
public SomeLongNameSpace.PolicyPremiumReturnType ProcessPremiums(
int userID,
int divisionID,
string ObjectCode,
int iPolicyID,
int iBulkEndorsementID,
System.Data.DataTable dtClientPremiums,
System.Data.DataTable dtClientPremiumInterests,
System.Data.DataTable dtRiskCommissions,
System.Data.DataTable dtBrokerages,
System.Data.DataTable dtDiscounts,
System.Data.DataTable dtApportionments,
System.Data.DataTable dtUWGroups,
System.Data.DataTable dtUWGroupSettings,
System.Data.DataTable dtUWGroupPremiums,
System.Data.DataTable dtRiskDeclarations,
System.Data.DataTable dtRiskDeclarationsInterests,
int clientPaymentIntervalDays,
int uwDefaultPaymentIntervalDays,
int uwPaymentIntervalDays,
System.Data.DataTable dtSchedulesLimitDetails,
XII.Integration.GlobalXB.v1_4.PolicyGL.CommissionProcessingFlags commissionProcessingFlags,
bool isOverrideWarranties,
string transactionDescription,
string TechnicalContactName,
bool isCreateDeclarationWithoutInterests,
int clientRPPaymentIntervalDays,
System.Data.DataTable deferredPayments)
{
return base.Channel.ProcessPremiums(userID, divisionID, ObjectCode, iPolicyID, iBulkEndorsementID, dtClientPremiums, dtClientPremiumInterests, dtRiskCommissions, dtBrokerages, dtDiscounts, dtApportionments, dtUWGroups, dtUWGroupSettings, dtUWGroupPremiums, dtRiskDeclarations, dtRiskDeclarationsInterests, clientPaymentIntervalDays, uwDefaultPaymentIntervalDays, uwPaymentIntervalDays, dtSchedulesLimitDetails, commissionProcessingFlags, isOverrideWarranties, transactionDescription, TechnicalContactName, isCreateDeclarationWithoutInterests, clientRPPaymentIntervalDays, deferredPayments);
}
few params
+1
class Program
{
static void Main()
{
UInt64 num;
Console.WriteLine(num = F(Convert.ToUInt64(Console.ReadLine())));
Main();
}
static UInt64 F(UInt64 number)
{
return number <= 0 ? 1 : number * F(number - 1);
}
}
Считывание числа и выдача его факториала while(true).
+2
public static string Get(this HttpWebRequest req)
{
string res;
string ErrorCode="";
try
{
ErrorCode = "100";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "101";
Stream dataStream = response.GetResponseStream();
ErrorCode = "102";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "103";
res = sr.ReadToEnd();
ErrorCode = "104";
}
catch
{
try
{
ErrorCode = "105";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse) req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "106";
Stream dataStream = response.GetResponseStream();
ErrorCode = "107";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "108";
res = sr.ReadToEnd();
ErrorCode = "109";
}
catch
{
try
{
ErrorCode = "110";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "111";
Stream dataStream = response.GetResponseStream();
ErrorCode = "112";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "113";
res = sr.ReadToEnd();
ErrorCode = "114";
}
catch
{
res = "Error doing get to " + req.RequestUri.AbsoluteUri + " ErrorCode: " + ErrorCode;
}
}
}
return res;
}
Нашел в проекте код до 2010 год, автор неизвестен :(
−1
var inited = Connectivity.Init().Result;
inited = ServerService.Init().Result && inited;
inited = AccountInfoService.Init().Result && inited;
inited = InitMandatoryServices() && inited;
IsInit = inited;
+12
var time = startDate.ToString("MM/dd/yyyy H:mm").Split(' ')[1]; // 07/21/2007 15:07
Надо было получить только время :D
+4
using System;
namespace project5
{
class Program
{
static void Main(string[] args)
{
}
class Petux
{
private int petux = "kukareku!";
public Petux():this(5)
{
}
public Petux(int i):this()
{
}
}
}
}
обратите внимание на строку 13
При всем при этом код компилится!
http://ideone.com/XIQDfK
Внимание вопрос - уважаемые знатоки, почему?
+5
_members[member.Member.MemberExpression.Member] = member.Member;
В исходниках Linq2db
+125
public enum ActionTypes
{
view = 1,
edit = 2,
all_view,
inc_view = 3,
inn_view = 4,
order_view = 5,
out_view = 6,
compl_view = 7
}
Три часа искал в чем баг, перерыл весь код, а оказалось...бля...