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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:25:22+00:00 2026-05-28T07:25:22+00:00

I got this code that works (simplified) : Assembly lib = Assembly.LoadFile(C:\\mydll.dll); var libType

  • 0

I got this code that works (simplified) :

Assembly lib = Assembly.LoadFile("C:\\mydll.dll");
var libType = lib.GetTypes();
Type mvType = libType[0];
PropertyInfo WidthProperty = mvType.GetProperty("Width");

But then, I’d like to access to the default value with a code like

var WidthPropertyValue = WidthProperty.GetValue(???, null);

The thing is that we CAN’T instantiate the object with Activator.CreateInstance cause the constructor need that the whole huge project is loaded to work… anyway, that’s not the point about working around that problem.
The thing is that, is it possible to access to the default way with this strategy ?
Is it possible with another way ?
completely impossible ?

  • 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-28T07:25:23+00:00Added an answer on May 28, 2026 at 7:25 am

    If the assembly code is accessible I would recommend defining default values with an Attribute.

    Otherwise I don’t think its possible. Property default values are not part of an assembly’s metadata (default value concept does not exist as such, that is why DefaultValueAttribute exists) so I’m not sure you can figure it out short of creating an instance of the object. It could be anything: default value of the backing field, some value set in the constructor, it could be based on some environment condition, etc.

    UPDATE: I’ve seen a few answers/comments pointing to creating the default type of the property’s type. Property default values are implementation specific, not type specific. They might coincide in many cases but it doesn’t have to be so.

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

Sidebar

Related Questions

I've got this code, that works in the latest version of firefox, opera and
I've got this php code that works perfectly: preg_match_all( '/<div style=display:block; float:left; height:240px; width:150px;'
I've got this code that's changing a picture and additional link with it. var
I'm a rookie with LINQ to XML and I've got this code that works
Ok, I've got this code that I've been using to spit out news to
I've got this really simple piece of code that I thought was the correct
I got this javascript code from off the internet. It's a script that changes
I've got a problem with inheritance and generics. This is the code that illustrates
Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php

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.