Click here to Skip to main content
15,887,427 members
Home / Discussions / C#
   

C#

 
GeneralRe: Report Designer Pin
Marc Clifton10-Feb-04 1:47
mvaMarc Clifton10-Feb-04 1:47 
GeneralRe: Report Designer Pin
Roger Alsing10-Feb-04 2:44
Roger Alsing10-Feb-04 2:44 
GeneralRe: Report Designer Pin
Marc Clifton10-Feb-04 3:50
mvaMarc Clifton10-Feb-04 3:50 
GeneralRe: Report Designer Pin
Itanium10-Feb-04 20:22
Itanium10-Feb-04 20:22 
GeneralTranslating from Delphi to C# - problem with objects. Pin
Andres Coder9-Feb-04 17:48
Andres Coder9-Feb-04 17:48 
GeneralRe: Translating from Delphi to C# - problem with objects. Pin
John Kuhn9-Feb-04 19:16
John Kuhn9-Feb-04 19:16 
GeneralRe: Translating from Delphi to C# - problem with objects. Pin
Andres Coder10-Feb-04 2:45
Andres Coder10-Feb-04 2:45 
GeneralRe: Translating from Delphi to C# - problem with objects. Pin
John Kuhn10-Feb-04 10:45
John Kuhn10-Feb-04 10:45 
OK, just for fun, I re-wrote your delphi code in C#. Not that I'm sure this implementation is even correct, or that it does anything desirable, but it will compile. So, in TMyBookClass.cs, we have:

using System;
using System.Collections;

namespace Books
{
	public abstract class TMyBook {
		string FName;

		public abstract TMyBook Create(string AName);

		public virtual string Name {
			get { return FName; }
			set { FName = value; }
		}
	}

	public class TMyBookClass : TMyBook	{

		TMyBook ActiveBook;
		ArrayList Books = new ArrayList();

		public struct TBookInfo {
			public string Name;
			public TMyBook BookInstance;
			public TMyBookClass BookClass;
		}

		public TMyBookClass(string AName){
			this.Create(AName);
		}
		public override TMyBook Create(string AName) {
			this.Name = AName;
			return this;
		}

		public int FindBook(string AName) {
			for(int result = 0; result < Books.Count; result++) {
				TBookInfo bi = (TBookInfo)Books[result];
				if (bi.Name == AName) { return (result); }
			}
			return -1;
		}

		public void RegisterBookInfo(string AName, TMyBookClass ABookClass) {
			TBookInfo bi = new TBookInfo();
			bi.Name = AName;
			bi.BookClass = ABookClass;
			bi.BookInstance = null;
			Books.Add(bi);
		}

		public TMyBook GetBook(string AName) {
			int index;
			index = FindBook(AName);
			TBookInfo bi = (TBookInfo)Books[index];
			// Assert BookInstance = null;
			return bi.BookClass.Create(Name);
		}

		public void SetActiveBook(string ABookName) {
			ActiveBook = GetBook(ABookName);
		}
	}
}


Then, in the main class of a console application, you could...

TMyBookClass TMyNewBook = new TMyBookClass("New Book");
TMyNewBook.RegisterBookInfo("New Book", TMyNewBook); 
TMyNewBook.SetActiveBook("New Book");

GeneralCharacter array Pin
GetOn&GetGoing9-Feb-04 17:44
GetOn&GetGoing9-Feb-04 17:44 
GeneralRe: Character array Pin
Nick Parker9-Feb-04 18:28
protectorNick Parker9-Feb-04 18:28 
GeneralRe: Character array Pin
Marc Clifton10-Feb-04 1:49
mvaMarc Clifton10-Feb-04 1:49 
GeneralConversion from string to integer Pin
GetOn&GetGoing9-Feb-04 17:00
GetOn&GetGoing9-Feb-04 17:00 
GeneralRe: Conversion from string to integer Pin
John Kuhn9-Feb-04 17:06
John Kuhn9-Feb-04 17:06 
GeneralRe: Conversion from string to integer Pin
HAHAHA_NEXT10-Feb-04 4:09
HAHAHA_NEXT10-Feb-04 4:09 
GeneralConvert int to byte[4] Pin
Anonymous9-Feb-04 14:04
Anonymous9-Feb-04 14:04 
GeneralRe: Convert int to byte[4] Pin
John Kuhn9-Feb-04 16:11
John Kuhn9-Feb-04 16:11 
GeneralRe: Convert int to byte[4] Pin
HAHAHA_NEXT10-Feb-04 4:01
HAHAHA_NEXT10-Feb-04 4:01 
QuestionWhat hook? Pin
Anonymous9-Feb-04 13:51
Anonymous9-Feb-04 13:51 
AnswerRe: What hook? Pin
Mazdak9-Feb-04 19:42
Mazdak9-Feb-04 19:42 
GeneralRelative file paths Pin
dratti9-Feb-04 13:02
dratti9-Feb-04 13:02 
GeneralFunctions and pointers Pin
Kryal9-Feb-04 11:54
Kryal9-Feb-04 11:54 
GeneralRe: Functions and pointers Pin
Marc Clifton9-Feb-04 13:47
mvaMarc Clifton9-Feb-04 13:47 
GeneralBroadcast VS Multicast Pin
HAHAHA_NEXT9-Feb-04 11:07
HAHAHA_NEXT9-Feb-04 11:07 
GeneralRedirected StandardOutput and StandardError hanging Pin
Anonymous9-Feb-04 10:18
Anonymous9-Feb-04 10:18 
GeneralStarting a process on a remote machine with WMI Pin
Paul L C9-Feb-04 9:48
Paul L C9-Feb-04 9:48 

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.