Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get property type of list

var obj = new PropClassDemo();
foreach (PropertyInfo prop in obj.GetType().GetProperties())
{
	if(prop.PropertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(prop.PropertyType))
	{
		Console.Writeline("This prop's type is Ienumerable");
	}
}

//Note: string is an ienumerable too
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# select a row from datagridview by value 
Csharp :: c# remove all whitespaces from string 
Csharp :: c# randize list 
Csharp :: datetime month name 
Csharp :: c# generate guid from hash 
Csharp :: c# create array with n elements 
Csharp :: system.net.mail send html message 
Csharp :: C# setting property values through reflection with attributes 
Csharp :: group by ef core 
Csharp :: how to read a text file C# 
Csharp :: what is a model in c# 
Csharp :: c# numbers only 
Csharp :: unity banner Ad position 
Csharp :: c# operator overloading 
Csharp :: c# code skripte kommunizieren 
Csharp :: c# xml get root attributes 
Csharp :: draw on picturebox c# 
Csharp :: switch case with 2 variables c# 
Csharp :: how to set border for groupbox in c# 
Csharp :: unity reset random seed 
Csharp :: initialize a char array java 
Csharp :: #ifdef in c 
Csharp :: c# combobox lock edit 
Csharp :: C# unit test exception using attribrute 
Csharp :: c# linq list select 
Csharp :: class in c# 
Csharp :: c# get string in parentheses 
Csharp :: euler to quaternion 
Csharp :: c# check if object is of any generic type 
Csharp :: for statement syntax C sharp 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =