Hi Chistina,
This may seems a rather silly question, but ..
Does the class has any field?
I tried this with a class with several properties and it worked fine
changing GetField by GetProperties and it worked fine
I now tried this code below and it also worked fine:
class A
{
public int a;
public int c;
public int b;
}
Type LType = typeof(A);
if (LType.IsClass)
{
Console.WriteLine ("Type Name : {0}", LType.FullName);
try
{
foreach (FieldInfo LFieldInfo in
LType.GetFields(BindingFlags.Public | BindingFlags.NonPublic|
BindingFlags.Instance))
{
Console.WriteLine ("{0}", LFieldInfo.Name);
}
Console.WriteLine("__");
}
catch (Exception LEx)
{
Console.WriteLine(LEx.Message);
}
}
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Christina Androne" <ac********@home.ro> wrote in message
news:eX*************@TK2MSFTNGP10.phx.gbl...
Jon Skeet [C# MVP] wrote:
Christina Androne <ac********@home.ro> wrote: I've read the docs and evrything seems fine. Then what I am missing
?
You haven't specified BindingFlags.Instance or BindingFlags.Static.
<snip>
I did :( ... It's not working :( ... I've tried all sort of flags, not
to mention the GetFields() method. I copypasted the last thing I tried,
that's why it was without the BindingFlags.Instance.
Christina Androne