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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:57:18+00:00 2026-05-11T14:57:18+00:00

Looking at the example code on MSDN : This ‘ Declares a type. Dim

  • 0

Looking at the example code on MSDN:

This

    ' Declares a type.     Dim type1 As New CodeTypeDeclaration('Type1')      ' Declares a constructor.     Dim constructor1 As New CodeConstructor     constructor1.Attributes = MemberAttributes.Public     type1.Members.Add(constructor1)      ' Declares an integer field.     Dim field1 As New CodeMemberField('System.Int32', 'integerField')     type1.Members.Add(field1)      ' Declares a property.     Dim property1 As New CodeMemberProperty     property1.Name = 'integerProperty'     property1.Type = New CodeTypeReference(GetType(Integer))     ' Declares a property get statement to return the value of the integer field.     property1.GetStatements.Add(New CodeMethodReturnStatement(New CodeFieldReferenceExpression(New CodeThisReferenceExpression, 'integerField')))     ' Declares a property set statement to set the value to the integer field.     ' The CodePropertySetValueReferenceExpression represents the value argument passed to the property set statement.     property1.SetStatements.Add(New CodeAssignStatement(New CodeFieldReferenceExpression(New CodeThisReferenceExpression, 'integerField'), New CodePropertySetValueReferenceExpression))     type1.Members.Add(property1)      Dim dump As New VBCodeProvider     Dim gen As Compiler.ICodeGenerator = dump.CreateGenerator     Dim opt As New Compiler.CodeGeneratorOptions      gen.GenerateCodeFromType(type1, Console.Out, opt) 

should generate

Public Class Type1     Private integerField As Integer     Public Sub New()        MyBase.New()    End Sub     Private Property integerProperty() As Integer        Get            Return Me.integerField        End Get        Set(ByVal Value As Integer)            Me.integerField = value        End Set    End Property End Class 

But I’m not seeing it generate the parameter to the Set method, I.e. I get:

       Set            Me.integerField = value        End Set 

Given that I already had to add in bits to the example code to actually name the property to match their example output, I suspect that there is a detail missing that is causing this, but I can’t seem to track it down? Whilst the code compiles, I’m unable to use the properties without manually adding in the parameters, which defeats the purpose somewhat. Any idea what is missing?

  • 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. 2026-05-11T14:57:19+00:00Added an answer on May 11, 2026 at 2:57 pm

    Comment #3 on this DevCity article suggests it shouldn’t matter, but I do know that Reflector does behave as you’re expecting, although it may have it’s own implementation for code generation…

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

Sidebar

Ask A Question

Stats

  • Questions 141k
  • Answers 141k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Pages stored in the Layouts folder are Application Pages and… May 12, 2026 at 8:04 am
  • Editorial Team
    Editorial Team added an answer A quirk of PHP requires that form controls end their… May 12, 2026 at 8:04 am
  • Editorial Team
    Editorial Team added an answer That is not how the HTML standard is. You make… May 12, 2026 at 8:04 am

Related Questions

Looking at the example code on MSDN : This ' Declares a type. Dim
I am a newbie to API calls in .NET. I am looking at the
How can I find out the properties and methods of COM objects returned from
I usually play with elisp code on my scratch buffer. I find it hard
A weird bug was occurring in production which I was asked to look into.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.