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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:03:07+00:00 2026-05-26T06:03:07+00:00

I am using jabber.net in C# and there is a quirk that has confused

  • 0

I am using jabber.net in C# and there is a quirk that has confused me so hopefully someone can explain how it is doing it. I am still quite new to C# from a C++ background so it may be a misunderstanding there

I am creating a readonly JID to hold a room that I need to enter:

private readonly JID messagingRoomJID;

public MyClass
{
   // Reads from database but for purpose of this question
   messagingRoomJID = new JID("user@myserver");
}

Later I want to join a room which is where I get the thing I am confused by

conferenceManager = new ConferenceManager();
conferenceManager.Stream = xmppClient;

// Before entering this room messagingRoomJID.Resource == null
theRoom = conferenceManager.GetRoom(messagingRoomJID);
// But now messagingRoomJID.Resource contains my username

But how is Resource being changed? The variable is readonly but also shouldn’t it be passed by const reference, so how is it being updated anyway?

It looks like I can do it by this but I am not sure it is sensible:

theRoom = conferenceManager.GetRoom(new JID(messagingRoomJID));
  • 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-26T06:03:08+00:00Added an answer on May 26, 2026 at 6:03 am

    It’s not changing the value of your variable. The value of your variable is just a reference. That reference is staying the same as it was before.

    What’s changing is the data within the object that the reference refers to. The readonly modifier only applies to your variable – it doesn’t say anything about the mutability of the object itself.

    It’s very important to distinguish between references and objects – see my article on the topic for more information.

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

Sidebar

Related Questions

I'm using the smack library to handle an XMPP/Jabber connection. I know that smack
I am trying to connect to facebook chat using Jabber.net(c#/Mono). The code I am
When using Perl's Net::Jabber , sending a simple message to an offline user causes
I'm making simple XMPP client using Jabber-Net. To send simple message i'm using a
I am trying to create a Jabber (Jabber.net) chat client using Unity3D(Mono/C#) for iOS
as all we know that we can create very simple chat using ajax timer
I have a messaging aspect of my application using Jabber-net (an XMPP library .)
After importing the jabber-net dlls from here into my project and running using UnityEngine;
I have created a chat application using the Jabber Smack API. I'm successfully receiving
I'm trying to make a simple Jabber client using the libstrophe library. It's going

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.