You are here: PSPad forum > English discussion forum > C# Code Explorer regression
Posted by: MrData | Date: 2017-02-05 12:42 | IP: IP Logged
Hello,
it seems the Code Explorer for C# at some point lost the ability to "see" Methods / Properties. Right now (tested in 4.6.0 and the newest dev build 4.6.2 (2743)) all ftCSharp is able to see are using directives, namespaces & classes, and regions.
The reason I said "regression" in the subject is that I could've sworn that the Code Explorer found methods in classes too (not sure about properties) in one of the older (4.5.x) builds.
Can somone confirm?
Edited 1 time(s). Last edit at 2017-02-05 12:43 by MrData.
Posted by: pspad | Date: 2017-02-05 15:09 | IP: IP Logged
Plese send me some source sample where the Code explorer works wrong with some description what's wrong.
Posted by: MrData | Date: 2017-02-08 15:55 | IP: IP Logged
Does the image sufficiently explain what's missing? Usually the Code Explorer lists methods / functions here, that can be double-clicked to quickly navigate to them (compare for example with "function Main(){ }" in a javascript file...)
Posted by: pspad | Date: 2017-02-08 21:37 | IP: IP Logged
Hello. I asked you about source code, not for picture
Spare my time please.
Posted by: MrData | Date: 2017-02-09 15:02 | IP: IP Logged
No problem, here you go (i think your forum software destroys indentation though):
using System;
using System.ComponentModel;
using System.Collections.Generic;
namespace ConsoleApplication1
{
public class Helpers
{
public static IEnumerable<PropertyValue> GetProperties(object o)
{
if (o != null) {
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(o);
foreach (PropertyDescriptor prop in props) {
object val = prop.GetValue(o);
if (val != null) {
yield return new PropertyValue { Name = prop.Name, Value = val };
}
}
}
}
public sealed class PropertyValue
{
public string Name { get; set; }
public object Value { get; set; }
}
}
class Program
{
static void Main(string[] args)
{
var anon=new { Key1="Val1", Key2="Val2", Key3="Val3", Key4="Val4"};
foreach (Helpers.PropertyValue nameValue in Helpers.GetProperties(anon))
{
Console.WriteLine("{0}={1}", nameValue.Name, nameValue.Value);
}
Console.ReadKey();
}
}
}
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR