© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
7 replies
Davaaron

Why do i need to pass in the generics here?

Hey,
I have this code
using GitManager.Domain.Models;
using GitManager.GitCLI.Commands.Parsing;

namespace GitManager.GitCLI.Commands
{
    public record GitPullBranchCommandInput : IGitCommandInput
    {
        public string LocalPath { get; }
        /// <summary>
        /// When not specified, the current local checked out branch will be pulled.
        /// </summary>
        public string? Branch { get; }

        public GitPullBranchCommandInput(string localPath, string? branch = null)
        {
            LocalPath = localPath;
            Branch = branch;
        }
    }
    public class GitPullBranchCommand : IGitCommand<string, GitPullBranchCommandInput>
    {
        private readonly IGitCommandStrategy _gitCommandStrategy;

        public GitPullBranchCommand(IGitCommandStrategy gitCommandStrategy)
        {
            _gitCommandStrategy = gitCommandStrategy;
        }

        public async Task<string> ExecuteAsync(GitPullBranchCommandInput input)
        {
            //var command = "branch --list --all";
            var command = "pull";
            var result = await _gitCommandStrategy.ExecuteAsync(command, input.LocalPath);

            return result;
        }
    }
}
using GitManager.Domain.Models;
using GitManager.GitCLI.Commands.Parsing;

namespace GitManager.GitCLI.Commands
{
    public record GitPullBranchCommandInput : IGitCommandInput
    {
        public string LocalPath { get; }
        /// <summary>
        /// When not specified, the current local checked out branch will be pulled.
        /// </summary>
        public string? Branch { get; }

        public GitPullBranchCommandInput(string localPath, string? branch = null)
        {
            LocalPath = localPath;
            Branch = branch;
        }
    }
    public class GitPullBranchCommand : IGitCommand<string, GitPullBranchCommandInput>
    {
        private readonly IGitCommandStrategy _gitCommandStrategy;

        public GitPullBranchCommand(IGitCommandStrategy gitCommandStrategy)
        {
            _gitCommandStrategy = gitCommandStrategy;
        }

        public async Task<string> ExecuteAsync(GitPullBranchCommandInput input)
        {
            //var command = "branch --list --all";
            var command = "pull";
            var result = await _gitCommandStrategy.ExecuteAsync(command, input.LocalPath);

            return result;
        }
    }
}


and i want to use to probably like this
Branch branch = await gitHandler.ExecuteAsync(new GitPullBranchCommandInput(""));
Branch branch = await gitHandler.ExecuteAsync(new GitPullBranchCommandInput(""));


But it says i cannot the determine the types... why not?! they are clearly given..
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

why do we need IAsyncDisposable here?
C#CC# / help
3y ago
idk what I need to do here
C#CC# / help
3y ago
I need help with inheriting generics
C#CC# / help
4y ago
❔ Do I need Marshal.AddRef/Release here?
C#CC# / help
3y ago