Click here to Skip to main content
15,388,979 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 21:39
MemberMarc Hede12-Dec-19 21:39 
AnswerRe: How do I change this code using Inheritance? Pin
Richard MacCutchan12-Dec-19 22:15
mveRichard MacCutchan12-Dec-19 22:15 
AnswerRe: How do I change this code using Inheritance? Pin
phil.o12-Dec-19 22:23
mvephil.o12-Dec-19 22:23 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 22:57
MemberMarc Hede12-Dec-19 22:57 
GeneralRe: How do I change this code using Inheritance? Pin
phil.o12-Dec-19 23:26
mvephil.o12-Dec-19 23:26 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede12-Dec-19 23:49
MemberMarc Hede12-Dec-19 23:49 
GeneralRe: How do I change this code using Inheritance? Pin
F-ES Sitecore12-Dec-19 23:59
professionalF-ES Sitecore12-Dec-19 23:59 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 0:17
MemberMarc Hede13-Dec-19 0:17 
Ah of course.
Sometimes it surprises me how simple the solution is. I tend to overthink things Big Grin | :-D

The only issue now is that I get a
System.Runtime.Serialization.SerializationException

at
C#
Mykey = (int)info.GetValue("Keynumber", typeof(int));


Do I need to add Keynumber in my other class file?
C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace Keycard
{
    class Class1
    {
        public static void Main(string[] args)
        {
            Keycard k1 = new Keycard("John", 123);

            Stream stream = File.Open("KeycardData.dat",
                FileMode.Create);

            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(stream, k1);
            stream.Close();

            k1 = null;

            stream = File.Open("KeycardData.dat", FileMode.Open);

            bf = new BinaryFormatter();

            k1 = (Keycard)bf.Deserialize(stream);
            stream.Close();
            Console.WriteLine(k1.ToString());
            Console.ReadLine();
        }

    }
}

GeneralRe: How do I change this code using Inheritance? Pin
phil.o13-Dec-19 0:52
mvephil.o13-Dec-19 0:52 
GeneralRe: How do I change this code using Inheritance? Pin
F-ES Sitecore13-Dec-19 0:54
professionalF-ES Sitecore13-Dec-19 0:54 
GeneralRe: How do I change this code using Inheritance? Pin
Richard Deeming13-Dec-19 0:58
mveRichard Deeming13-Dec-19 0:58 
GeneralRe: How do I change this code using Inheritance? Pin
Richard MacCutchan13-Dec-19 0:00
mveRichard MacCutchan13-Dec-19 0:00 
GeneralRe: How do I change this code using Inheritance? Pin
Marc Hede13-Dec-19 0:25
MemberMarc Hede13-Dec-19 0:25 
GeneralRe: How do I change this code using Inheritance? Pin
Richard MacCutchan13-Dec-19 0:44
mveRichard MacCutchan13-Dec-19 0:44 
QuestionHistogram in Asp.net using canvas js Pin
pooja thombare11-Dec-19 20:47
Memberpooja thombare11-Dec-19 20:47 
AnswerRe: Histogram in Asp.net using canvas js Pin
Richard MacCutchan11-Dec-19 21:16
mveRichard MacCutchan11-Dec-19 21:16 
JokeRe: Histogram in Asp.net using canvas js Pin
Richard Deeming12-Dec-19 12:54
mveRichard Deeming12-Dec-19 12:54 
AnswerRe: Histogram in Asp.net using canvas js Pin
phil.o11-Dec-19 23:05
mvephil.o11-Dec-19 23:05 
QuestionI can´t get any output from XML and Binary. Pin
Marc Hede8-Dec-19 3:51
MemberMarc Hede8-Dec-19 3:51 
AnswerRe: I can´t get any output from XML and Binary. Pin
Richard MacCutchan8-Dec-19 5:15
mveRichard MacCutchan8-Dec-19 5:15 
GeneralRe: I can´t get any output from XML and Binary. Pin
Marc Hede8-Dec-19 7:17
MemberMarc Hede8-Dec-19 7:17 
GeneralRe: I can´t get any output from XML and Binary. Pin
Richard MacCutchan8-Dec-19 21:51
mveRichard MacCutchan8-Dec-19 21:51 
QuestionExample Needed Pin
Mycroft Holmes30-Nov-19 12:02
professionalMycroft Holmes30-Nov-19 12:02 
QuestionRe: Example Needed Pin
Maciej Los3-Dec-19 1:53
mveMaciej Los3-Dec-19 1:53 
QuestionProblem with Using Directive Pin
Dawud Ahmad29-Nov-19 17:00
MemberDawud Ahmad29-Nov-19 17:00 

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.