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 389119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:50:09+00:00 2026-05-12T15:50:09+00:00

I tend to write lots of test using boost/unit_test and I tend to generate

  • 0

I tend to write lots of test using boost/unit_test and I tend to generate lots of const data – for instance

#include <vector>
#include <map>
#include <string>

#include <boost/assign.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/assign/std/vector.hpp>
#include <boost/assign/std/map.hpp>

namespace ba = boost::assign;
using namespace std;

const vector<int> my_vector_of_ints = ba::list_of(15)(23)(43)(22)(5)(78);
const map<int, string> my_map = ba::map_list_of(5, "abc")(7, "ddd");

etc. etc. etc.

How do I go about this stuff in C# ?

  • 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-12T15:50:10+00:00Added an answer on May 12, 2026 at 3:50 pm

    Try something like this:

    readonly List<int> myListOfInts 
        = new List<int> { 15, 23, 43, 22, 5, 78 };
    readonly Dictionary<int, string> myMap 
        = new Dictionary<int, string> { { 5, "abc" }, { 7, "ddd" } };
    

    Now C#’s const doesn’t mean the same thing as C++’s const so you will need to realize that these instances are mutable. I have marked these fields as readonly which is about as close as you are going to get.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the zend framework to write an app and I'm having lots of
I tend to do a lot of projects on short deadlines and with lots
We mostly tend to following the above best practice. Have a look at String
EDIT: Note that due to the way hard drives actually write data, none of
I tend to write a good amount of documentation so the MediaWiki format to
I write a lot of scripts in Python to analyze and plot experimental data
During my day-to-day work, I tend to come across data that I want to
For simple output formatting I tend to use printf where I used write/format in
I tend to write my javascript as big blocks of code without many variable
I'm inclined to write if statements by using logical negation operator: if (!p) some_code();

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.