Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6249705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:17:18+00:00 2026-05-24T13:17:18+00:00

I built a fluent interface like this: criador.Include(Idade, 21).Include(Idade, 21); Can I do something

  • 0

I built a fluent interface like this:

criador.Include("Idade", 21).Include("Idade", 21);

Can I do something like this:

criador.Include({"Idade", 21},{"Idade", 21});

I tryed to user method with params keyword:

public myType Include(params[] KeyValuePair<string,object> objs){
    //Some code
}

But I need to do this:

criador.Include(new KeyValuePair<string, object>{"Idade", 21}, new KeyValuePair<string, object>{"Idade", 21});

The point is that i dont want to write no “new” keyword on the methods

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:17:19+00:00Added an answer on May 24, 2026 at 1:17 pm

    You could use an implicit conversion:

    public class ConvertibleKeyValuePair
    {
        public ConvertibleKeyValuePair(string key, int value)
        {
            _key = key;
            _value = value;
        }
    
        public static implicit operator ConvertibleKeyValuePair(string s)
        {
            string[] parts = s.Split(';');
            if (parts.Length != 2) {
                throw new ArgumentException("ConvertibleKeyValuePair can only convert string of the form \"key;value\".");
            }
            int value;
            if (!Int32.TryParse(parts[1], out value)) {
                throw new ArgumentException("ConvertibleKeyValuePair can only convert string of the form \"key;value\" where value represents an int.");
            }
            return new ConvertibleKeyValuePair(parts[0], value);
        }
    
        private string _key;
        public string Key { get { return _key; } }
    
        private int _value;
        public int Value { get { return _value; } }
    
    }
    

    // Tests

    private static ConvertibleKeyValuePair[] IncludeTest(
        params ConvertibleKeyValuePair[] items)
    {
        return items;
    }
    
    private static void TestImplicitConversion()
    {
        foreach (var item in IncludeTest("adam;1", "eva;2")) {
            Console.WriteLine("key = {0}, value = {1}", item.Key, item.Value);
        }
        Console.ReadKey();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a newbie in Objective-c and I would like to implement fluent interface
I have a fluent interface for an IoC container registration process, and this contains
I built a UserControl with a dependency property like this: public MyUserContol() { InitializeComponent();
Method chaining is the only way I know to build fluent interfaces. Here's an
Which built in (if any) tool can I use to determine the allocation unit
I've built an ASP.NET MVC application with MVC 2.0 and Fluent NHibernate (hided behind
We have been having this issue pop up sporadically, but now I can reproduce
I am looking for examples and experience of using fluent interface to define simple
I'm using Fluent NHibernate in order to auto map my entities. This is the
NBuilder has two of the following fluent methods .Has(..) .Have(..) eg. return Builder<User>.CreateListOfSize(100) .WhereTheFirst(1)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.