Questions tagged [fieldinfo]
54 questions
1
vote
0 answers
How can I get MemberInfos of a class in the order the members are declared?
Let's say I have the following class:
public class Target
{
public int field1;
public int field2;
public int Prop1 { get; set; }
public int Prop2 { get; set; }
}
If I do a:
foreach(far f in typeof(Target).GetFields())
…

vexe
- 5,433
- 12
- 52
- 81
1
vote
2 answers
Parse field/property path?
So I wrote this code that could parse a property path from a start object, returns the wanted property and it takes an out param for the source object for which the returned property could be invoked upon:
public static PropertyInfo…

vexe
- 5,433
- 12
- 52
- 81
1
vote
1 answer
C# Developing .Net3.5 using reflection to get/set values to nested properties and/or nested fields
I'm developing an app that works with data block classes inheritied from a base class and I am trying to use Reflection to drill down to properties/fields in my data block class. Since all the data block classes are derived/inherited from the base…

Lorentz
- 181
- 1
- 3
- 13
1
vote
2 answers
Simplest way to get all MemberInfos that reflect the state of an object?
I need to get all members that represent the exact state of an object using reflection. So these members include fields (FieldInfo) and auto-properties (PropertyInfo). I can get all the FieldInfos using
type.GetFields(); //ok some flags needed…

nawfal
- 70,104
- 56
- 326
- 368
0
votes
1 answer
Type.AssemblyQualifiedName for fields
Is there a way to get something like the Type.AssemblyQualifiedName property, which differentiates between a List of strings and a List of bytes, from a System.Reflection.FieldInfo?
The FieldInfo.GetFullName() method doesn't differentiate between…

Orvid King
- 1,188
- 10
- 16
0
votes
0 answers
How to get the value of fieldInfo into a generic base type
C#. I have the following classes:
public class SomeDerivedClass : SomeSuperClass
{
}
public class Game : SomeSuperClass
{
public List inventory_changes = new List();
}
public class SomeSuperClass
{
…

SticksInGoo
- 1
- 1
0
votes
0 answers
c# reflection read from json and fieldinfo.setvalue error
i got a question here,hope warmheat developer help.
this is the problem i meet:
i want to save a class instance's fields due to reflection,the code below:
private void SaveFields()
{
fieldItemList.Clear();
FieldInfo[] fields =…

yangyang2035
- 1
- 3
0
votes
0 answers
Need help using Text to Columns & Fieldinfo to parse columns with VBA in Excel
Per comments below, I'm editing my original posted question to more accurately reflect my problem.
This is for my job. In my work program, I download my data table to a csv file and it automatically opens the data in Notepad. I don't save the file…

Macca
- 1
- 4
0
votes
2 answers
Getting a PropertyInfo.Name from a FieldInfo object
I have a method which uses some FieldInfo objects:
public static T SetFieldValue(this T src, string propName, object value)
{
Type type = typeof(T);
FieldInfo propInfo = type.GetField(propName,
…

Theodor3gabriel
- 58
- 8
0
votes
1 answer
What is the type of element (of a collection) which retrieve from using Activator.CreateInstance method?
I have a case which is very similar to the case below:
Get all inherited classes of an abstract class
I have two classes which inherited to a base class
this is my base class:
public abstract class InputModule
{
public string ModuleName;
…

Kuo-hsuan Hsu
- 677
- 1
- 6
- 12
0
votes
2 answers
How to convert fieldinfo to it's actual class object? using C#
i need to create program that navigate an object structure and print the structure of any “struct” provided as an argument.
These "structs" are defined as follows:
They have only public attributes
Each attribute can be of the following types: …

Meital Machorlo
- 3
- 1
- 2
0
votes
1 answer
activePDF underline fieldinfo in .net
I am using Adobe Acrobat Standard DC 2015 Release (Classic), Version 2015.006.3028 and Visual Studio 2013 MVC5 with VB.net. This is an office so I can't just upgrade my versions.
I have an issue with the fact that activePDF does not allow underline…

Susan O
- 65
- 1
- 8
0
votes
0 answers
c# Generic way to stringify arrays of structs
I've searched for quite some time, but I have not been able to find how to generically stringify an array of structures in C# at runtime.
Let's say I have
public enum FieldInfoType
{
FitUInt32,
FitStruct,
FitUint32Array1D,
…

Paul Grinberg
- 1,184
- 14
- 37
0
votes
1 answer
C# How to call FieldInfo.SetValue function without manual type conversion
I want to save data-class instance to database and load it from database. and I want to generate sql command automatically. so, I think that I need to use dictionary< string, string> so that solve it.
refer my old question : How to convert 2D string…

yeminfa
- 13
- 1
- 7
0
votes
1 answer
GetValue() from a variable field inside a class
Suppose I have a simple class:
public class TestScript : MonoBehaviour {
public Vector3 myVector3;
}
Now I want to iterate through an the fields of an instance of this class and to access the fields of this field (Field-Ception!) and assign…

Cherno
- 59
- 1
- 7