get fields with reflection

前端 未结 3 1860
忘掉有多难
忘掉有多难 2020-12-16 03:51

I want to get all fields that have null values but i aint even getting any fields:

  [Serializable()]
public class BaseClass
{
    [OnDeserialized()]
    int         


        
3条回答
  •  伪装坚强ぢ
    2020-12-16 04:31

    Value1 and Value2 in your Settings class are properties rather than fields, so you'll need to use GetProperties() to access them.

    (Using the { get; set; } syntax tells the compiler that you want a property, but that it should generate the get and set for you, along with a hidden private field that contains the data.)

提交回复
热议问题