Results 1 to 5 of 5

Thread: [1.0/1.1] Reference operator: Checking the memory location (maybe a noob question)

  1. #1

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    [1.0/1.1] Reference operator: Checking the memory location (maybe a noob question)

    Hello,

    In C++, if we declare an object of type, say int, we can check its memory location using reference operator, i.e. &.

    Is some kind of Reference operator also present in C#?? Or is it possible to check the memory location in C# also?? If yes, how??

    Thank you.
    Show Appreciation. Rate Posts.

  2. #2
    Hyperactive Member BramVandenbon's Avatar
    Join Date
    Jan 2002
    Location
    Belgium
    Posts
    502

    Re: [1.0/1.1] Reference operator: Checking the memory location (maybe a noob question)

    Quote Originally Posted by Harsh Gupta
    Hello,

    In C++, if we declare an object of type, say int, we can check its memory location using reference operator, i.e. &.

    Is some kind of Reference operator also present in C#?? Or is it possible to check the memory location in C# also?? If yes, how??

    Thank you.
    I will give you a link because I think the following page gives better and more complete information than I could possibly give you:
    Pointer Types (C# Programming Guide) @ MSDN

    Well it's not recommonded of course. Usually I put [CLSCompliant(true)] at the start of most of my classes. That makes my C# classes reusable in all the other .NET languages (such as VB.NET, J#.NET, ... etc.) Personally I see it like a quality-Indicator for myself. There are some conditions to be able to put this CLSCompliant tag though. Just one of them is <not using pointers>.

    I hope I have enlightened you .
    ____________________________________________

    Please rate my messages. Thank you!
    ____________________________________________
    Bram Vandenbon
    http://www.bramvandenbon.com

  3. #3

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [1.0/1.1] Reference operator: Checking the memory location (maybe a noob question)

    Thanks for the link. I was just curious to know about Pointers in C#, otherwise I agree with your point that using unsafe keyword is not a good practise.
    Show Appreciation. Rate Posts.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [1.0/1.1] Reference operator: Checking the memory location (maybe a noob question)

    Bah!

    It's only not a good practice if you don't know what you're doing. Which, since you've used C/C++, I assume you do.

  5. #5
    Hyperactive Member BramVandenbon's Avatar
    Join Date
    Jan 2002
    Location
    Belgium
    Posts
    502

    Re: [1.0/1.1] Reference operator: Checking the memory location (maybe a noob question)

    Quote Originally Posted by penagate
    It's only not a good practice if you don't know what you're doing.
    You should be careful however when creating a Code Library Project (DLL) that you will reuse in other .NET languages.

    "A small tactical decision can have huge strategic consequences."
    Last edited by BramVandenbon; Nov 27th, 2006 at 10:59 AM.
    ____________________________________________

    Please rate my messages. Thank you!
    ____________________________________________
    Bram Vandenbon
    http://www.bramvandenbon.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width