HowToForums.net Forum Index HowToForums.net
An Open Source of Knowledge
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Displaying Class Members From Assembly :

 
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion
View previous topic :: View next topic  
Author Message
sharonshmuelfeldman



Joined: 29 Jul 2009
Posts: 8

PostPosted: Mon Aug 03, 2009 7:31 pm    Post subject: Displaying Class Members From Assembly : Reply with quote

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Attributes;
using System.Reflection;


namespace My_Functions
{
public class attribute_check
{
public static void disp_member(Type myType)
{
MemberInfo[] myMembers = myType.GetMembers(BindingFlags.Static |
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
Console.WriteLine("members for {0}:", myType);
Console.WriteLine("-------------------");
for (int i = 0; i < myMembers.Length; i++)
{
Console.WriteLine("member {0}:", myMembers[i]);
}
}
}
}
/////////////////
// how to use in main : fro example

attribute_check.disp_member(typeof(ParkingLot));

you can play with the BindingFlags to print members you like.
________
Steaming
Back to top
Display posts from previous:   
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group