Last active
September 25, 2019 11:57
-
-
Save Sergio0694/45f8b6fd3fbf5f5d65e2ce30d27217ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Main() | |
{ | |
object instance = "Hello world"; | |
Type type = instance.GetType(); // System.String | |
PropertyInfo property = type.GetProperty("Length"); | |
object value = property.GetValue(instance); | |
Console.WriteLine(value); // Prints 11 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment