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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:31:16+00:00 2026-05-20T18:31:16+00:00

In delphi the ZeroMemory procedure, ask for two parameters. CODE EXAMPLE procedure ZeroMemory(Destination: Pointer;

  • 0

In delphi the “ZeroMemory” procedure, ask for two parameters.

CODE EXAMPLE

procedure ZeroMemory(Destination: Pointer; Length: DWORD);
begin
 FillChar(Destination^, Length, 0);
end;

I want make this, or similar in C#… so, what’s their equivalent?

thanks in advance!

  • 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-20T18:31:17+00:00Added an answer on May 20, 2026 at 6:31 pm

    .NET framework objects are always initialized to a known state

    .NET framework value types are automatically ‘zeroed’ — which means that the framework guarantees that it is initialized into its natural default value before it returns it to you for use. Things that are made up of value types (e.g. arrays, structs, objects) have their fields similarly initialized.

    In general, in .NET all managed objects are initialized to default, and there is never a case when the contents of an object is unpredictable (because it contains data that just happens to be in that particular memory location) as in other unmanaged environments.

    Answer: you don’t need to do this, as .NET will automatically “zero” the object for you. However, you should know what the default value for each value type is. For example, the default of a bool is false, and the default of an int is zero.

    Unmanaged objects

    “Zero-ing” a region of memory is usually only necessary in interoping with external, non-managed libraries.

    If you have a pinned pointer to a region of memory containing data that you intend to pass to an outside non-managed library (written in C, say), and you want to zero that section of memory, then your pointer most likely points to a byte array and you can use a simple for-loop to zero it.

    Off-topic note

    On the flip side, if a large object is allocated in .NET, try to reuse it instead of throwing it away and allocating a new one. That’s because any new object is automatically “zeroed” by the .NET framework, and for large objects this clearing will cause a hidden performance hit.

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

Sidebar

Related Questions

Delphi strings use single quotes, for example ' a valid string '. How does
Delphi 2009 has changed its string type to use 2 bytes to represent a
Delphi (and probably a lot of other languages) has class helpers. These provide a
Delphi 2009, among some cool stuff, has also just got Anonymous methods. I've seen
Delphi 2009 introduced a hierarchical system for project options configuration, where you set base
Delphi has a $WARN compiler directive that allows one to selectively enable or disable
Delphi 8 introduced Class Helpers for the purposes of mapping the VCL/RTL to the
Delphi sometimes adds {$R *.res} in front of the unit path in the .dpr
In Delphi, I want to be able to create an private object that's associated
Does Delphi call inherited on overridden procedures if there is no explicit call in

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.