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

  • Home
  • SEARCH
  • 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 5959757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:43:48+00:00 2026-05-22T18:43:48+00:00

public class Foo<T> where T: Entity {} public class Foo1 : Foo<Telephone> { }

  • 0
public class Foo<T> where T: Entity
{}

public class Foo1
: Foo<Telephone>
{
}

public class Foo2
: Foo<Home>
{   
}

How do I send Foo1 to Foo2? I realize that the message is typed, and hence messages of the same type of recieved – but I need to message between the derived classes…

An example would be very much appreciated.

  • 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-22T18:43:48+00:00Added an answer on May 22, 2026 at 6:43 pm

    the messaging in mvvmlight is in theory supposed to be fire and forget…the sender doesnt care who gets the message and the receiver doesnt care who sends the message, so long as its the right type that its listening for.
    I have found through much trial and error that its much easier to craft your own messages than use the default provided by mvvm-light, they are a good starting point, but sometimes you will just findyourself jumping through hoops..

    public class ExceptionMessage : GalaSoft.MvvmLight.Messaging.GenericMessage<System.Exception>
        {
            public ExceptionMessage(System.Exception content) : base(content) { }
            public ExceptionMessage(object sender, System.Exception content) : base(sender, content) { }
            public ExceptionMessage(object sender, object target, System.Exception content) : base(sender, target, content) { }
        }
    

    Receiver code:

    Messenger.Default.Register<Core.Messaging.ExceptionMessage>(this, ex => ShowExceptionMessage(ex));
    

    Sender Code:

    public void LogException(Exception content)
            {
                _messenger.Send<Core.Messaging.ExceptionMessage>(new ExceptionMessage(content));
                //GetBw().RunWorkerAsync(content);
                WriteToDatabaseLog(content);
            }
    

    and yes this does break the suggestion in my first sentence, but in theory I could have several vms or view listening for exception messages.

    Maybe another example to help you out… i hate the whole foo thing…its always confuses me…

    This is in my core module:

    public class SaveNotification<T> : GalaSoft.MvvmLight.Messaging.NotificationMessage<T> where T : GalaSoft.MvvmLight.ViewModelBase
        {
            public SaveNotification(T content, string notification) : base(content, notification) { }
            public SaveNotification(object sender, T content, string notification) : base(sender, content, notification) { }
            public SaveNotification(object sender, object target, T content, string notification) : base(sender, target, content, notification) { }
        }
    

    here is how I used it in my vm:

    public void OnSubmitChanges(SubmitOperation so)
            {
                if (so.HasError)
                {
                    Infrastructure.GetService<IExceptionLoggingInterface>().LogException(this, so.Error);
                }
                else
                {
                    //Save Responses
                    _messenger.Send<Messages.NavigationRequest<SubClasses.URI.PageURI>>(GetNavRequest_HOME());
                    ClearQuestionaire(true);
                    _messenger.Send<WavelengthIS.Core.Messaging.SaveNotification<QuestionairreViewModel>>(GetSuccessfulSaveNotification());
    
                }
    
                Wait.End();
            }
    
            private WavelengthIS.Core.Messaging.SaveNotification<QuestionairreViewModel> GetSuccessfulSaveNotification()
            {
                return new WavelengthIS.Core.Messaging.SaveNotification<QuestionairreViewModel>(this, "Save Successfull");
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have a class Foo: public class Foo { public static
Given the following class public class Foo { public int FooId { get; set;
As an example: public class Foo { private Foo() {} } public class Bar
Assuming the following class stub: public class Foo<T> { private Class<T> type; public Foo<T>
I have the simple class using auto-implemented properies: Public Class foo { public foo()
Imagine a base class with many constructors and a virtual method public class Foo
I have this class. public class Foo { public Guid Id { get; set;
I'm used to writing classes like this: public class foo { private string mBar
Assume the following type definitions: public interface IFoo<T> : IBar<T> {} public class Foo<T>
Given a class like this: class Foo { public: Foo(int); Foo(const Foo&); Foo& operator=(int);

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.