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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:01:10+00:00 2026-06-08T11:01:10+00:00

Possible Duplicate: Passing object messages in Azure Queue Storage I am working on a

  • 0

Possible Duplicate:
Passing object messages in Azure Queue Storage

I am working on a use case that requires my queue messages a few more properties than the ones provided by Windows Azure Queue Messages (CloudQueueMessage class). I can’t use most of the properties in CloudQueueMessage as they are mostly protected.

So I thought of inheriting the CloudQueueMessage and add my extra properties to the derived class fails. My derived class looks like below:

public class AzureQueueMessage : CloudQueueMessage
{
      public AzureQueueMessage(string content): base(content)
      {
      }

      //My new property
      public string Label { get; set; }
}

Rest of my message insertion and retrieval code looks like below:

AzureQueueMessage message = new AzureQueueMessage("testing");
cloudQueue.AddMessage(message);
CloudQueueMessage qmessage = cloudQueue.GetMessage();
AzureQueueMessage azureMessage = qmessage as AzureQueueMessage;

Here, cloudQueue is my Azure Queue instance.

The message inserts fine, but azureMessage is always null as the cast back to my derived class.

I did come across a solution on similar lines here but I am yet to try it out.

Is this behavior normal or am I missing something?

  • 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-08T11:01:12+00:00Added an answer on June 8, 2026 at 11:01 am

    Those are the basic principles of OOP. When you use the “as AzureQueueMessage” cast, you actually say: “Try to see if this is instance is actually an AzureQueueMessage”. But GetMessage() does not return an AzureQueueMessage, it returns an CloudQueueMessage, and there’s no way you can change that.

    If you want to work with an instance of your AzureQueueMessage you’d have to create it afterwards yourself. You could write an constructor that accepts the returned CloudQueueMessage and takes over all values.

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

Sidebar

Related Questions

Possible Duplicate: passing in object by ref With the code below, the output would
Possible Duplicate: Passing two command parameters using a WPF binding I need that send
Possible Duplicate: PHP passing parameters via URL I know that if you have a
Possible Duplicate: passing a pointer by reference in c++ I have a function that
Possible Duplicates: Why use ref keyword when passing an Object? When to pass ref
Possible Duplicate: Passing an IDisposable object by reference causes an error? Why doesn't C#
Possible Duplicate: Convert a JSON string to object in Java? I'm working on a
Possible Duplicate: Passing multidimensional arrays as function arguments in C I'm trying to use
Possible Duplicate: Understanding Python's call-by-object style of passing function arguments I recently came across
Possible Duplicate: Passing only two variables between controller and view - best practice? There

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.