Mistři v programování na #hovnokod

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,

Čitateľný kód nie je priorita...

        private void RemoveItemPrices(ItemDto itemDto, Item dbItem)
        {
            for (int i = dbItem.ItemPrices.Count - 1; i >= 0; i--)
            {
                var item = dbItem.ItemPrices[i];
                if (!itemDto.ItemPrices.Select(p => p.Id).Contains(item.Id))
                {
                    _ctx.ItemPrices.Remove(item);
                    dbItem.ItemPrices.Remove(item);
                }
            }
        }

Anonymous,