Click here to Skip to main content
15,441,032 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem to read Com port with while loop? Pin
OriginalGriff11-Apr-22 1:28
mveOriginalGriff11-Apr-22 1:28 
AnswerRe: Problem to read Com port with while loop? Pin
Raphael Adeniji11-Apr-22 2:39
MemberRaphael Adeniji11-Apr-22 2:39 
AnswerRe: Problem to read Com port with while loop? Pin
Luc Pattyn11-Apr-22 12:21
sitebuilderLuc Pattyn11-Apr-22 12:21 
QuestionMigrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Raphael Adeniji10-Apr-22 19:44
MemberRaphael Adeniji10-Apr-22 19:44 
AnswerRe: Migrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Richard MacCutchan10-Apr-22 21:28
mveRichard MacCutchan10-Apr-22 21:28 
GeneralRe: Migrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Raphael Adeniji11-Apr-22 2:28
MemberRaphael Adeniji11-Apr-22 2:28 
GeneralRe: Migrating Web Applications (Web Forms) to Dot Net Core Blazor Applications Pin
Richard MacCutchan11-Apr-22 6:06
mveRichard MacCutchan11-Apr-22 6:06 
QuestionWill calling a new method/property work if called on a "base" abstract object Pin
pr1mem0ver9-Apr-22 18:42
Memberpr1mem0ver9-Apr-22 18:42 
I am working with SharpCompress and creating a parser that creates objects mimicking real folder structures to use in various browsable controls. Since the IEntry and IArchiveEntry interfaces in SharpCompress have all the makings of an "info" class, I have created two custom Info classes derived from System.IO.FileSystemInfo. Because most of the properties are NOT virtual, I have to use the new keyword to override them so that I can grab the info from the Entry object instead of the file system.

I want to use the base class FileSystemInfo to supply much of the data for my virtual file system object class. However, I am not sure if using the FileSystemInfo object will work with the derived classes that hide the original properties. Check the relevant part of my code below:

C#
public class IOObjectNode : TreeNode;
{
	FileSystemInfo info;
	FileInfo file;
	DirectoryInfo folder;
	ArchiveDirectoryInfo virtualFolder;
	ArchiveFileInfo virtualFile;

	IEntry entry;
	public string FileName { get { return info.Name; } }
	public string Path { get { return System.IO.Path.GetDirectoryName(info.FullName); } }
	public string FullName { get { return info.FullName; } }
	public DateTime LastWriteTime { get { return info.LastWriteTime; } }
	public DateTime CreationTime { get { return info.CreationTime; } }
	public long Size { get { if (file != null) return file.Length; else return 0; } }
	public long Length { get { return Size; } }
	public IOObjectNode() { }
	public void Populate(IEntry entry) { SharpEntry = entry; }
	public void Populate(FileSystemInfo info) { ShellInfo = info; }

	public FileSystemInfo ShellInfo
	{
		get { return info; }
		protected set
		{
			info = value;
			file = value as FileInfo;
			folder = value as DirectoryInfo;
			virtualFolder = value as ArchiveDirectoryInfo;
			virtualFile = value as ArchiveFileInfo;

			UpdateResources();
		}
	}

	public IEntry SharpEntry
	{
		get { return entry; }
		protected set
		{
			entry = value;
			UpdateResources();
		}
	}
}


Notice my use of "info" in some of the properties above. Will this work with my custom class instances when info is the base class?
AnswerRe: Will calling a new method/property work if called on a "base" abstract object Pin
pr1mem0ver9-Apr-22 20:20
Memberpr1mem0ver9-Apr-22 20:20 
GeneralRe: Will calling a new method/property work if called on a "base" abstract object Pin
OriginalGriff9-Apr-22 22:16
mveOriginalGriff9-Apr-22 22:16 
GeneralRe: Will calling a new method/property work if called on a "base" abstract object Pin
pr1mem0ver10-Apr-22 6:10
Memberpr1mem0ver10-Apr-22 6:10 
QuestionProblem with BackgroundWorker component? Pin
Member 140558797-Apr-22 1:23
MemberMember 140558797-Apr-22 1:23 
AnswerRe: Problem with BackgroundWorker component? Pin
Richard MacCutchan7-Apr-22 1:41
mveRichard MacCutchan7-Apr-22 1:41 
AnswerRe: Problem with BackgroundWorker component? Pin
Luc Pattyn7-Apr-22 6:30
sitebuilderLuc Pattyn7-Apr-22 6:30 
AnswerRe: Problem with BackgroundWorker component? Pin
Gerry Schmitz7-Apr-22 6:30
mveGerry Schmitz7-Apr-22 6:30 
QuestionC# Exception: An object reference does not point to an instance of an objec Pin
Member 155831391-Apr-22 0:29
MemberMember 155831391-Apr-22 0:29 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
Richard Deeming1-Apr-22 0:51
mveRichard Deeming1-Apr-22 0:51 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
OriginalGriff1-Apr-22 0:53
mveOriginalGriff1-Apr-22 0:53 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
Richard MacCutchan1-Apr-22 1:07
mveRichard MacCutchan1-Apr-22 1:07 
GeneralRe: C# Exception: An object reference does not point to an instance of an objec Pin
Dave Kreskowiak1-Apr-22 2:12
mveDave Kreskowiak1-Apr-22 2:12 
GeneralRe: C# Exception: An object reference does not point to an instance of an objec Pin
Gary R. Wheeler2-Apr-22 3:21
MemberGary R. Wheeler2-Apr-22 3:21 
GeneralRe: C# Exception: An object reference does not point to an instance of an objec Pin
Pete O'Hanlon5-Apr-22 4:03
mvaPete O'Hanlon5-Apr-22 4:03 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
Raphael Adeniji10-Apr-22 14:20
MemberRaphael Adeniji10-Apr-22 14:20 
AnswerRe: C# Exception: An object reference does not point to an instance of an objec Pin
Raphael Adeniji12-Apr-22 3:36
MemberRaphael Adeniji12-Apr-22 3:36 
QuestionAccess Android Tablet from C# Pin
Kevin Marois30-Mar-22 18:23
professionalKevin Marois30-Mar-22 18:23 

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.