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

  • Home
  • SEARCH
  • 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 9253917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:20:17+00:00 2026-06-18T11:20:17+00:00

I have this bit of code NullableConverter nullableConverter = new NullableConverter(type); Type baseType =

  • 0

I have this bit of code

 NullableConverter nullableConverter = new NullableConverter(type);
 Type baseType = nullableConverter.UnderlyingType;
 Object value = Convert.ChangeType(rule.Data, baseType);
 constant = Expression.Constant(value);

In this case type is decimal? but it could be any nullable type.

I need value to be of type decimal?, not type decimal as it currently is. The problem, is that Convert.ChangeType doesn’t work properly with nullable types. So I’m creating a non-nullable first.

How can I convert the string contained in rule.Data to type?

  • 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-06-18T11:20:18+00:00Added an answer on June 18, 2026 at 11:20 am

    You can’t.

    When a nullable struct is boxed in an Object it doesn’t store a boxed nullable struct. If the struct doesn’t have a value it will just box null, and if it has a value it will box the underlying value of the nullable struct.

    You would need to not be boxing it for this to even be possible.

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

Sidebar

Related Questions

I have this bit of code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
I use this bit of code to feed some data i have parsed from
I have this bit of code, which serializes an object to a file. I'm
I have this bit of code that helps me convert enum to string and
I have this bit of code that repeates. <div class='commentfloatleft'> <button type='button' class='button2' onclick='upvote($id8)'>
I have this bit of code: ... var aData = request.responseXML.getElementsByTagName('data')[0]; var sDescription =
I have this bit of code <input type=image src=/wp-content/themes/happy/images/add-to-cart.png name=Buy class=wpsc_buy_button id=product_<?php echo wpsc_the_product_id();
Say I have this little bit of code: public static void LoadSomething(Type t) {
I have this bit of code: setListAdapter(new ArrayAdapter<String> (this, R.layout.actiemenu, array)); ListView lv =
i have this bit of code, it limits the Li's to 15 of them

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.