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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:49:35+00:00 2026-06-13T12:49:35+00:00

Marshal.DestroyStructure is marked with the Pure attribute in the .NET Framework but I’m unsure

  • 0

Marshal.DestroyStructure is marked with the Pure attribute in the .NET Framework but I’m unsure as to why when it clearly has an effect on the context calling it.

The state is modified (the pointer is freed) even if it doesn’t directly modify the pointer instance itself.

Implied in the question is: Can a developer, in good faith, mark something as Pure even if she knows it modifies the context’s state indirectly?

  • 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-13T12:49:36+00:00Added an answer on June 13, 2026 at 12:49 pm

    It’s Pure in the sense that it has no effect on visible managed state, which means, for the purpose of code contracts, calling the method could not violate class invariants.

    Granted, it’s slightly misleading to think of the method as Pure, as it does have side effects, even if those side effects are not visible. They are observable (if you try to use the pointer after freeing it, you’ll cause a failure), but not exactly visible (you can’t tell without trying to use the pointer that something is wrong.) I’m not sure what the motivation was for marking the method Pure, since I can’t see why it would have ever been used in a Contracts block, but I’m guessing there must have been some reason somewhere deep in the BCL contracts that required it.

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

Sidebar

Related Questions

How to marshal the type of Cstring in .NET Compact Framework(C#)? DLLname:Test_Cstring.dll(OS is WinCE
My .NET library has to marshal strings to a C library that expects text
I'm trying to marshal an object which has a DataHandler field with JAXB (2.1.12).
I've been looking through the Marshal class, but I can't seem to find a
I want to marshal/unmarshal 2 custom types. And the type 1 has a List.
I'm using (Excel.Application)Marshal.GetActiveObject(Excel.Application) It returns me a _ComObject type but I was wondering how
When I marshal an XML with this attribute marshal.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); marshal.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); it will
I have a requirement to marshal both json and xml outputs. But, how to
In .NET remoting what is the difference between RemotingConfiguration.RegisterWellKnownServiceType and RemotingServices.Marshal? What I want
I'm trying to marshal data between SDL and my C# .NET program. The first

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.