Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-7-sonnet-20250219-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

Ты senior dotnet developer c опытом 10+ лет. Сделай рефакторинг метода, используя c#…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-flash-lite-preview-06-17-thinking’s answer.
  1. User

    Ты senior dotnet developer c опытом 10+ лет. Сделай рефакторинг метода, используя c# версии 11+ private static IQueryable ApplyPropertyFilter( IQueryable query, KeyValuePair<string, string[]> property) { var predicate = BuildPropertyPredicate(property.Key, property.Value); if(property.Key.Contains("CRM", StringComparison.InvariantCultureIgnoreCase)) { predicate = predicate.Or(x => property.Value.Contains(x.Document.CrmClientId)); } if(property.Key == "applicationId") { predicate = predicate.Or(x => property.Value.Contains(x.Document.ApplicationId)); } if(property.Key == "okzRequestNumber") { predicate = predicate.Or(x => property.Value.Contains(x.Document.OkzRequestNumber)); } return query.Where(predicate); }

  2. Claude Assistant
    private static IQueryable<DocumentVersion> ApplyPropertyFilter(
        IQueryable<DocumentVersion> query,
        KeyValuePair<string, string[]> property)
    {
        var (key, values) = property; // Деконструкция KeyValuePair, доступна с C# 7, но хорошо вписывается в современный стиль
        
        var predicate = BuildPropertyPredicate(key, values);
        
        // Используем паттерн-матчинг для строк и сокращенную запись условий
        if (key.Contains("CRM", StringComparison.InvariantCultureIgnoreCase))
            predicate = predicate.Or(x => values.Contains(x.Document.CrmClientId));
        
        if (key is "applicationId")
            predicate = predicate.Or(x => values.Contains(x.Document.ApplicationId));
        
        if (key is "okzRequestNumber")
            predicate = predicate.Or(x => values.Contains(x.Document.OkzRequestNumber));
        
        return query.Where(predicate);
    }
    

    Хотите, чтобы я объяснил или разбил код?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.