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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:44:29+00:00 2026-05-28T06:44:29+00:00

The only .NET language i know is C#. In C# you can write lhs=rhs

  • 0

The only .NET language i know is C#. In C# you can write lhs=rhs and if its a struct it will copy by value, if a class it copies by reference.

Does the .NET CLI support doing either on any type of object? Can i create a struct Pt { int x, y; } and do something like

Pt pt
var pt_ref=&pt
pt_ref.x=99 //pt.x is now 99
var pt_cpy=pt
pt_cpy.x=88 //nothing else has changed
  • 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-28T06:44:30+00:00Added an answer on May 28, 2026 at 6:44 am

    At the IL level references to value types are a possibility. C# disallows them (except in parameters, using the ref keyword), but in C++/CLI you can write your example:

    value struct Pt
    {
        int x;
        int y;
    };
    
    void f()
    {
        Pt pt;
        Pt% ptRef = pt;
        ptRef.x = 99;
        Pt ptCpy = pt;
        ptCpy.x = 88;
    }
    

    However, the other way around is not possible. If you have a reference type, and you create a copy of that, you create a copy of the reference itself, not of the referenced object. If you want to copy the referenced object, you need to write a function to copy it yourself.

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

Sidebar

Related Questions

Can a LINQ enabled app run on a machine that only has the .NET
On the .Net WebBrowser control the only way I can see to load a
I've created a copy utility in c# (.NET 2.0 Framework) that copies files, directories
sorry for my language - in English i can only read :) i want
Does anyone know of a DOT Language (or other GraphViz-ish format) Parser for .NET?
I have built a simple C#.Net app on a M/C with only .Net FX
I work on a small web team where I am the only .NET developer
It's possible to develop only for .net 2.0 running Visual Studio 2008? Thanks!
I have searched the net and searched the net only to not quite find
We have a service that has some settings that are supported only over net.tcp.

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.