Click here to Skip to main content
14,452,780 members
   

ASP.NET

 
GeneralRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Mou_kol24-Dec-19 22:14
MemberMou_kol24-Dec-19 22:14 
GeneralRe: ASP.Net MVC: How data is serialize into model when pass to client side from action Pin
Richard Deeming7-Jan-20 9:09
communityengineerRichard Deeming7-Jan-20 9:09 
QuestionHow do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 22:39
MemberMarc Hede12-Dec-19 22:39 
AnswerRe: How do I change this code using Inheritance? Pin
Richard MacCutchan12-Dec-19 23:15
communityengineerRichard MacCutchan12-Dec-19 23:15 
AnswerRe: How do I change this code using Inheritance? Pin
phil.o12-Dec-19 23:23
mvephil.o12-Dec-19 23:23 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 23:57
MemberMarc Hede12-Dec-19 23:57 
GeneralRe: How do I change this code using Inheritance? Pin
phil.o13-Dec-19 0:26
mvephil.o13-Dec-19 0:26 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 0:49
MemberMarc Hede13-Dec-19 0:49 
Hey Phil.
Thanks a lot
I almost got it to work. Only one error left thankfully.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace Keycard
{
    [Serializable()]
    public class Person : ISerializable
    {
        protected string name;

        public Person(string name)
        {
            this.Name = name;
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {

            info.AddValue("Name", name);

        }
        public Person(SerializationInfo info, StreamingContext context)
        {
            Name = (string)info.GetValue("Name", typeof(string));
        }
    }
    [Serializable()]
    public class Keycard : Person
    {
        protected int mykey;

        public Keycard(string name)
            : base (name)
        {
            this.Mykey = -1;
        }
        public Keycard(string name, int mykey) : base(name)
        {
            this.Mykey = mykey;
        }
        public int Mykey
        {
            get { return mykey;  }
            set { mykey = value; }
        }

        public new void GetObjectData(SerializationInfo info, StreamingContext context)
        {

            info.AddValue("Keynumber", mykey);

        }
        public Keycard(SerializationInfo info, StreamingContext context)
        {
           Mykey = (int)info.GetValue("Keynumber", typeof(int));
        }
        public override string ToString()
        {
            return "Name: " + name + " ---- " + " Keynumber: " + mykey;
        }
    }
}


The only problem here is this line
public Keycard(SerializationInfo info, StreamingContext context)


I get the constructor error again.
I understood your solution with the default name arguement, but how do I apply that logic here?
GeneralRe: How do I change this code using Inheritance? Pin
F-ES Sitecore13-Dec-19 0:59
mveF-ES Sitecore13-Dec-19 0:59 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 1:17
MemberMarc Hede13-Dec-19 1:17 
GeneralRe: How do I change this code using Inheritance? Pin
phil.o13-Dec-19 1:52
mvephil.o13-Dec-19 1:52 
GeneralRe: How do I change this code using Inheritance? Pin
F-ES Sitecore13-Dec-19 1:54
mveF-ES Sitecore13-Dec-19 1:54 
GeneralRe: How do I change this code using Inheritance? Pin
Richard Deeming13-Dec-19 1:58
communityengineerRichard Deeming13-Dec-19 1:58 
GeneralRe: How do I change this code using Inheritance? Pin
Richard MacCutchan13-Dec-19 1:00
communityengineerRichard MacCutchan13-Dec-19 1:00 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 1:25
MemberMarc Hede13-Dec-19 1:25 
GeneralRe: How do I change this code using Inheritance? Pin
Richard MacCutchan13-Dec-19 1:44
communityengineerRichard MacCutchan13-Dec-19 1:44 
QuestionHistogram in Asp.net using canvas js Pin
pooja thombare11-Dec-19 21:47
Memberpooja thombare11-Dec-19 21:47 
AnswerRe: Histogram in Asp.net using canvas js Pin
Richard MacCutchan11-Dec-19 22:16
communityengineerRichard MacCutchan11-Dec-19 22:16 
JokeRe: Histogram in Asp.net using canvas js Pin
Richard Deeming12-Dec-19 13:54
communityengineerRichard Deeming12-Dec-19 13:54 
AnswerRe: Histogram in Asp.net using canvas js Pin
phil.o12-Dec-19 0:05
mvephil.o12-Dec-19 0:05 
QuestionI can´t get any output from XML and Binary. Pin
Marc Hede8-Dec-19 4:51
MemberMarc Hede8-Dec-19 4:51 
AnswerRe: I can´t get any output from XML and Binary. Pin
Richard MacCutchan8-Dec-19 6:15
communityengineerRichard MacCutchan8-Dec-19 6:15 
GeneralRe: I can´t get any output from XML and Binary. Pin
Marc Hede8-Dec-19 8:17
MemberMarc Hede8-Dec-19 8:17 
GeneralRe: I can´t get any output from XML and Binary. Pin
Richard MacCutchan8-Dec-19 22:51
communityengineerRichard MacCutchan8-Dec-19 22:51 
QuestionExample Needed Pin
Mycroft Holmes30-Nov-19 13:02
MemberMycroft Holmes30-Nov-19 13:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.