c# get all class properties
C#
//through reflection
using System.Reflection;
//Get a List of the properties from a type
public static ListOfPropertiesFromInstance(Type AType)
{
if (InstanceOfAType == null) return null;
return AType.GetProperties(BindingFlags.Public);
}
//Get a List of the properties from a instance of a class
public static ListOfPropertiesFromInstance(object InstanceOfAType)
{
if (InstanceOfAType == null) return null;
Type TheType = InstanceOfAType.GetType();
return TheType.GetProperties(BindingFlags.Public);
}
//purrfect for usage example and Get a Map of the properties from a instance of a class
public static Dictionary<string, object> DictionaryOfPropertiesFromInstance(object InstanceOfAType)
{
if (InstanceOfAType == null) return null;
Type TheType = InstanceOfAType.GetType();
PropertyInfo[] Properties = TheType.GetProperties(BindingFlags.Public);
Dictionary<string, PropertyInfo> PropertiesMap = new Dictionary<string, PropertyInfo>();
foreach (PropertyInfo Prop in Properties)
{
PropertiesMap.Add(Prop.Name, Prop);
}
return PropertiesMap;
}
Also in C#:
- Title
- how to track a branch on github
- Category
- C#
- Title
- c# display float with 2 decimal places
- Category
- C#
- Title
- math class C# exponents
- Category
- C#
- Title
- get set c#
- Category
- C#
- Title
- divide string in chunks c#
- Category
- C#
- Title
- nullreferenceexception c#
- Category
- C#
- Title
- change z value unity
- Category
- C#
- Title
- html hidden text
- Category
- C#
- Title
- c# request run as administrator
- Category
- C#
- Title
- fahrenheit to celsius c#
- Category
- C#
- Title
- get day month year from date c#
- Category
- C#
- Title
- how to work with ascii in c#
- Category
- C#
- Title
- c# multiline comment
- Category
- C#
- Title
- unity how to change rotation
- Category
- C#
- Title
- unity load text resources from subfolder
- Category
- C#
- Title
- c# dictionary add
- Category
- C#
- Title
- wpf get name of clicked element
- Category
- C#
- Title
- multidimensional meaning
- Category
- C#
- Title
- mouseposition unity
- Category
- C#
- Title
- firefoxoptions setpreference to trust certificates
- Category
- C#
- Title
- unity find object by name
- Category
- C#
- Title
- how to get odd saturday in a month in c#
- Category
- C#
- Title
- c# convert list to string
- Category
- C#
- Title
- how to change text to bold through script unity
- Category
- C#
- Title
- c sharp comments
- Category
- C#
- Title
- jumping with character controller unity
- Category
- C#
- Title
- unity rotate around point
- Category
- C#
- Title
- rotate player unity
- Category
- C#
- Title
- asp multi select dropdown
- Category
- C#
- Title
- c# download string url
- Category
- C#
- Title
- c# try catch error
- Category
- C#
- Title
- c# replace foreach with lambda
- Category
- C#
- Title
- c# discord bot
- Category
- C#
- Title
- check if network is available c#
- Category
- C#
- Title
- csharp first element of array
- Category
- C#
- Title
- c sharp how to read a text file
- Category
- C#
- Title
- Exception thrown: 'System.FormatException' in mscorlib.dll dates
- Category
- C#
- Title
- c# double value with 2 decimal places
- Category
- C#
- Title
- move character unity
- Category
- C#
- Title
- Unity if object doens't exist
- Category
- C#
- Title
- landscape print gridcontrol devexpress
- Category
- C#
- Title
- c# linq select from object list
- Category
- C#
- Title
- windows form rounded corners
- Category
- C#
- Title
- defining vectors in c#
- Category
- C#
- Title
- dont destroy on load unity
- Category
- C#
- Title
- edit form item from class C#
- Category
- C#
- Title
- x angle oes back after 90 unity
- Category
- C#
- Title
- c# throw new exception
- Category
- C#
- Title
- unity onclick addlistener
- Category
- C#
- Title
- animator hash in unity
- Category
- C#
- Title
- how to draw a dot in c#
- Category
- C#
- Title
- what does gameobject.find return
- Category
- C#
- Title
- unity how to make jump script
- Category
- C#
- Title
- c# LCP
- Category
- C#
- Title
- roulette algorithm genetic algorithm
- Category
- C#
- Title
- rotatearound unity
- Category
- C#
- Title
- how to add to a list c#
- Category
- C#
- Title
- Request.Form
- Category
- C#
- Title
- flip boolean c#
- Category
- C#
- Title
- asp.net mvc return file
- Category
- C#
- Title
- unity separator in inspector
- Category
- C#
- Title
- c# make request to rest api
- Category
- C#
- Title
- print gridcontrol devexpress
- Category
- C#
- Title
- round vector3 unity
- Category
- C#
- Title
- page refresh on button click in c#
- Category
- C#
- Title
- c# exit program
- Category
- C#
- Title
- c# how to exit program
- Category
- C#
- Title
- unity how to change max fps
- Category
- C#
- Title
- asp.net core 3.1: cast jObject to dictionary<string,string>
- Category
- C#
- Title
- c# param exception
- Category
- C#
- Title
- add getenumerator to class c#
- Category
- C#
- Title
- change canvas color uwp c#
- Category
- C#
- Title
- c# to vb.net
- Category
- C#
- Title
- get last element of array c#
- Category
- C#
- Title
- bytes size c#
- Category
- C#
- Title
- unity to string
- Category
- C#
- Title
- initialize enum with another enum c#
- Category
- C#
- Title
- unity rb.addexplosionforce 2d
- Category
- C#
- Title
- wpf binding object get value
- Category
- C#
- Title
- Unity3d GPS code
- Category
- C#
- Title
- how to switch scenes unity
- Category
- C#
- Title
- c# cancellationtoken
- Category
- C#
- Title
- c# skip following code in loop
- Category
- C#
- Title
- c# how to run external program
- Category
- C#
- Title
- convert double to currency c#
- Category
- C#
- Title
- C# assigning image location
- Category
- C#
- Title
- decalre an int list mvc
- Category
- C#
- Title
- unity how to get transform scale
- Category
- C#
- Title
- c# verify in class exist in list
- Category
- C#
- Title
- unity how to change text in script
- Category
- C#
- Title
- textblock line break
- Category
- C#
- Title
- get number of sundays in a month c#
- Category
- C#
- Title
- c# date
- Category
- C#
- Title
- create dropdown in datatable c# dynamically
- Category
- C#
- Title
- unity onselect gizmos wireframe
- Category
- C#
- Title
- asp.net c# write string to text file
- Category
- C#
- Title
- send type as argument c#
- Category
- C#
- Title
- open link c#
- Category
- C#
- Title
- datagridview column color c#
- Category
- C#
- Title
- how to delay something in c# unity
- Category
- C#