Click here to Skip to main content
15,898,993 members
Home / Discussions / C#
   

C#

 
GeneralRe: What would cause a COM object to lose its RCW? Pin
JoeRip10-Dec-07 21:37
JoeRip10-Dec-07 21:37 
GeneralRe: What would cause a COM object to lose its RCW? Pin
TJoe11-Dec-07 2:11
TJoe11-Dec-07 2:11 
GeneralCOM in c# [modified] Pin
Dromar10-Dec-07 12:30
Dromar10-Dec-07 12:30 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 13:21
sitebuilderLuc Pattyn10-Dec-07 13:21 
GeneralRe: COM in c# Pin
JoeRip10-Dec-07 14:01
JoeRip10-Dec-07 14:01 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 14:11
sitebuilderLuc Pattyn10-Dec-07 14:11 
GeneralRe: COM in c# Pin
Anthony Mushrow10-Dec-07 14:41
professionalAnthony Mushrow10-Dec-07 14:41 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 14:45
sitebuilderLuc Pattyn10-Dec-07 14:45 
GeneralRe: COM in c# Pin
Anthony Mushrow10-Dec-07 14:51
professionalAnthony Mushrow10-Dec-07 14:51 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 15:42
sitebuilderLuc Pattyn10-Dec-07 15:42 
GeneralRe: COM in c# Pin
Dromar10-Dec-07 14:31
Dromar10-Dec-07 14:31 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 14:42
sitebuilderLuc Pattyn10-Dec-07 14:42 
GeneralRe: COM in c# Pin
Dromar10-Dec-07 15:42
Dromar10-Dec-07 15:42 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 15:47
sitebuilderLuc Pattyn10-Dec-07 15:47 
QuestionHow to open-with a file using my application ? Pin
ZHM10-Dec-07 11:20
ZHM10-Dec-07 11:20 
GeneralRe: How to open-with a file using my application ? Pin
Luc Pattyn10-Dec-07 11:59
sitebuilderLuc Pattyn10-Dec-07 11:59 
GeneralRe: How to open-with a file using my application ? Pin
Ian Uy10-Dec-07 20:05
Ian Uy10-Dec-07 20:05 
GeneralCreating a Sound(say, a Beep) Pin
polishprogrammer10-Dec-07 11:14
polishprogrammer10-Dec-07 11:14 
GeneralRe: Creating a Sound(say, a Beep) Pin
Ravi Bhavnani10-Dec-07 11:18
professionalRavi Bhavnani10-Dec-07 11:18 
GeneralRe: Creating a Sound(say, a Beep) Pin
PIEBALDconsult10-Dec-07 12:20
mvePIEBALDconsult10-Dec-07 12:20 
GeneralRe: Creating a Sound(say, a Beep) Pin
JoeRip10-Dec-07 14:22
JoeRip10-Dec-07 14:22 
GeneralRe: Creating a Sound(say, a Beep) Pin
polishprogrammer11-Dec-07 9:18
polishprogrammer11-Dec-07 9:18 
QuestionCasting from a Type object Pin
Leonardo Pelisoli10-Dec-07 10:55
Leonardo Pelisoli10-Dec-07 10:55 
GeneralRe: Casting from a Type object Pin
m@u10-Dec-07 11:54
m@u10-Dec-07 11:54 
Hi
You could use Reflection to invoke the appropriate method. something like this:

public class Program
	{
		public Program()
		{
			
		}
		public void DoStuff()
		{
			BaseClass obj1 = new ClassA();
			BaseClass obj2 = new ClassB();
			ProcessObject(obj1);
			ProcessObject(obj2);
		}
		void ProcessObject(BaseClass obj)
		{
			Console.WriteLine("BaseClass");
			GetType().GetMethod("ProcessObject",System.Reflection.BindingFlags.NonPublic|System.Reflection.BindingFlags.Instance,null,new Type[]{obj.GetType()},null).Invoke(this,new object[]{obj});
		}
		void ProcessObject(ClassA obj)
		{
			Console.WriteLine("ClassA");
		}
		void ProcessObject(ClassB obj)
		{
			Console.WriteLine("ClassB");
		}
	}
	public class BaseClass
	{
	}
	public class ClassA:BaseClass
	{
	}
	public class ClassB:BaseClass
	{
	}

GeneralRe: Casting from a Type object [modified] Pin
PIEBALDconsult10-Dec-07 12:25
mvePIEBALDconsult10-Dec-07 12:25 

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.