Mistři v programování na #hovnokod

Aneb jak moc se dá nepochopit enum

public enum TransportMeaningEnum
	{
		Unknown = 0,
		Type1 = 1,	// typictky TRAM
		Type2 = 2,	// typicky BUS
		Type3 = 4,	// typicky TAXI
		Type4 = 8,	// typicky TRAIN
		Type5 = 16,	// typicky SHIP
		Type6 = 32,	// typicky CHUTE 
	}

Anonymous,

How to detect HTML in HTTP response

if(fetchResultString[0].Equals("<")
{
// is html
}

Anonymous,

Jak snadno spočítat polovinu něčeho.

    /// <summary>
    /// Class for extensions.
    /// </summary>
    public static class Extensions
    {
        /// <summary>
        /// Count the half value.
        /// </summary>
        /// <param name="valueToBeHalved">Value to be halved.</param>
        /// <returns>Returns half value</returns>
        public static double Halved(this double valueToBeHalved)
        {
            double halfCoefficient = 0.5;
            return valueToBeHalved * halfCoefficient;
        }
    }

Anonymous,

je to jasne???

var fromId = lastId;
var nextId = fromId;
do
{
   fromId = nextId;
   ...
}(nextId != fromId);

Anonymous,

štýl ala "Kapitán Andrej Danko"

public IEnumerable<PermissionGroupDto> Get()
        {
            var companyPermissionGroups = _ctx.CompanyPermissionGroups.Where(g => g.CompanyId == _user.CompanyId);
            return _ctx.PermissionGroups
                            .Include(g => g.Permissions)
                            .Join(
                                companyPermissionGroups,
                                c => c.Id,
                                t => t.PermissionGroupId,
                                (c, t) => _mapper.Map<PermissionGroupDto>(c)
                            );
        }

Anonymous,