Bonsoir,
Voici mon problème, je désire afficher les propriétés d'une classe grâce à la réflection en utilisant GetType() puis Type.GetProperties()
Je rencontre un premier problème au niveau de la réflection . En effet le code suivant fonctionne bien par exemple pour "System.IO.Directory" mais me retourne pour "System.Windows.RoutedEvent" l'exception suivante :
"L'exception System.NullReferenceException n'a pas été gérée
Message=La référence d'objet n'est pas définie à une instance d'un objet.
Source=ConsoleApplication1
StackTrace:
à ConsoleApplication1.Program.Main(String[] args) dans C:\Documents and Settings\michel\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs:ligne 19
à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
InnerException:
voici le petit programme
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Reflection;
using System.IO;
 
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
 
            Type type1 = Type.GetType("System.Windows.RoutedEvent"); ;
           string dd = type1.FullName;
           Console.WriteLine(dd);
 
            Console.ReadLine();
 
 
 
        }
    }
}
Pourriez-vous m'éclairer sur le sujet ?

Merci.