Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# fill values of child from parent

class Parent
{
  ...
}

class Child :Parent
{
  ...
  public Child(Parent p)
  {
            foreach (FieldInfo prop in  p.GetType().GetFields())
                GetType().GetField(prop.Name).SetValue(this, prop.GetValue( p));

            foreach (PropertyInfo prop in  p.GetType().GetProperties())
                GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue( p, null), null);
  }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: using selected item in listbox c# to fill texbox 
Csharp :: add-users:430 Uncaught TypeError: $(...).validate is not a function 
Csharp :: string to float c# 
Csharp :: binaural generator 
Csharp :: unity 3d fire shoting 
Csharp :: stack in c# 
Csharp :: esc exit winform 
Csharp :: c# sprintf equivalent 
Csharp :: www.elking.net 
Csharp :: c# how to convert string to float 
Csharp :: c# read key without writing 
Csharp :: how to specify order of test in c# 
Csharp :: ArgumentOutOfRangeException when sorting a DataGridView using a custom IComparer 
Csharp :: Find Center Of Transforms, Points, Multiple Objects 
Csharp :: c# lambda get all records async 
Csharp :: access form in a folder C# 
Csharp :: How to solve error in ExecuteNonQuery() in asp.net 
Csharp :: how to input data several times in c# 
Csharp :: what is difference between int.Parse and toint32 in c# 
Csharp :: dapper execute with list of ids 
Csharp :: how to reset checkbox visual studio c# 
Csharp :: csvhelper driver c# nuget 
Csharp :: Fibonacci Ienumerable 
Csharp :: how to make a draggable visual studio panel 
Csharp :: access autoload godot 
Csharp :: scale curve revit api 
Csharp :: displaying list in gameobject Unity 
Csharp :: Datagridview causing IndexOutOfRangeException when clicked upon 
Csharp :: c# office interop copy slide to another pppt 
Csharp :: c# force arguments to be keywords 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =