|
When debugging, I can see the properties of this tasklist object, but I can't figure out how to access the properties programatically. As you can see in the screen capture below, the properties enumerate while debugging, how can I access those values?
Thanks!
http://img833.imageshack.us/img833/7081/g4rm.jpg[^]
|
|
|
|
|
For public properties, you can access them 'programmatically' as usual. For non-public ones, try to use reflection. There are a lot of articles on the internet telling about it.
|
|
|
|
|
If you can't access them directly in the usual way, then they are not intended to be available and the access modifier has been set to private or protected to prevent you getting at them.
While it would be possible (if rather slow) to access them via Reflection it is generally a very poor idea. They are not normally available for a reason, and because they aren't designed to be available there is no guarantee that they will work in the same way in the next version, or even exist at all.
Relying on items you have not been given normal access to is a very poor idea, and will often come back to bite you when you least expect it. I would not recommend it, not at all.
|
|
|
|
|
It is a public class that I got from code project actually.
A New Task Scheduler Class Library for .NET[^]
There is probably an easy way to modify this class code, I'm just not able to do it due to experience. Do you still feel the properties are hidden, or since this is a public class, I could expose them?
|
|
|
|
|
IF the properties are public, you can access them directly (or cast them into appropriate value).
|
|
|
|
|
Would you consider those public, if they are exposed by the IDE?
I'm able to cast this way
IEnumerable<Object> stList = serverTaskList.Cast<Object>();
but still not able to get intellisense to recognize the property names
|
|
|
|
|
The TaskList class only implements IEnumerable , not IEnumerable<T> . As a result, the implicit type of your task variable is Object , and you would need to cast it as a Task before you could access the properties.
The simplest solution is to specify the type name in your foreach loop:
foreach (Task task in serverTaskList)
{
...
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard. You're the man, you nailed it with that simple statement ... ugh I feel so foolish!
How did you know it only implemented IEnumerable and not IEnumerable<t> ?
|
|
|
|
|
turbosupramk3 wrote: How did you know it only implemented IEnumerable and not IEnumerable<T>?
I looked at the code[^] in the article[^] you linked to.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hello
I don't understand this, my app is perfectly not leaking memory and responsively and Task Manager "Detail" tab shows my app is consuming stead 350MB (I checked, update speed is Normal, so I am not looking at some stale counter) on this machine with 3900MB (i.e. almost 4GB)
Now, how come, when I close my process, the memory usage drops from 70% to 30%!?! Right away! as reported on Task Manager!? A 40% drop on this 3900GB machine is 1560MB - that's four times memory I am using. What am I reading here...?
Thanks in Advance
dev
|
|
|
|
|
First, STOP using Task Manager to tell you how much memory your .NET app is using.
It's telling you how much memory the .NET CLR has RESERVED for your app, not how much it's actually using.
This has been documented countless thousands of times all over the web. I know I've posted the explanation dozens of times here on CP.
.net memory task manager[^]
|
|
|
|
|
|
devvvy wrote: and second? This is not a C# question.
Veni, vidi, abiit domum
|
|
|
|
|
you have just contributed to the generally well being of code project Rich
dev
|
|
|
|
|
Just? That was nearly a week ago.
Veni, vidi, abiit domum
|
|
|
|
|
You already got the "second", I just didn't specify it.
|
|
|
|
|
dude, if google is more useful than you what good are you
dev
|
|
|
|
|
Google is only as useful as the person using (or NOT using) it.
If you can't do research and teach yourself, you're screwed in this business.
|
|
|
|
|
eat some icecream sour old man
dev
|
|
|
|
|
Funny you should say that...but it has nothing to do with ME being a sour old man.
|
|
|
|
|
Hey, I only speak the truth. If you can't handle it, don't be whiny about it and go get some ice cream yourself.
|
|
|
|
|
Good day
I a use a plugin interface to load a screen from a dll module. I created a thread to load a User Control from a separate dll. The user control form the plugin dll uses WPF to display some charts as a dashboard. When I use a normal WinForm user control it works fine but with the WPF user control I get a thread access error. Is there a way to allow access to the thread of a WPF form?
Here is my thread code that gets the uc from the dll
public void constructStartScreen()
{
ucSystemStartScreen _ucSystemStartScreen = new ucSystemStartScreen();
foreach (PluginInterface Plugin in TPlugins.PluginList)
{
if (Plugin.getSystemTag() == TPlugins.theSelectedPlugin)
{
ucBaseUserControl theStartScreen = new ucBaseUserControl();
theStartScreen = Plugin.getStartScreen();
if (theStartScreen != null)
{
theStartScreen.Dock = DockStyle.Fill;
theStartScreen.UserCurrentInfo.SetUserInfo(TUserInfo.UserID);
theStartScreen.UserCurrentInfo.IsLogedOn = TUserInfo.IsLogedOn;
theStartScreen.UserCurrentInfo.Connection = TUserInfo.Connection;
theStartScreen.theSystemDBTag = Plugin.getSystemDBTag();
_ucSystemStartScreen.setStartScreen(theStartScreen);
_ucSystemStartScreen.Dock = DockStyle.Fill;
DataTable RecentList = _MenuSystemDAO.getRecentList(TUserInfo.UserID);
_ucSystemStartScreen.loadRecentList(RecentList);
_ucSystemStartScreen.CanClose = true;
_ucSystemStartScreen.UserCurrentInfo.SetUserInfo(TUserInfo.UserID);
_ucSystemStartScreen.UserCurrentInfo.IsLogedOn = TUserInfo.IsLogedOn;
_ucSystemStartScreen.UserCurrentInfo.Connection = TUserInfo.Connection;
_ucSystemStartScreen.theSystemDBTag = Plugin.getSystemDBTag();
addStartScreen(_ucSystemStartScreen);
}
break;
}
}
}
The code in the DLL
public ucBaseUserControl getStartScreen()
{
ucHRStartScreen _ucHRStartScreen = new ucHRStartScreen();
return _ucHRStartScreen;
}
The
ucHRStartScreen has a elementhost control that loads the WPF screens.
|
|
|
|
|
There isn't enough code to see exactly what your doing, but the general problem is that you cannot touch/create/use/modify/whatever UI controls from anything other than the UI (startup) thread. Doing this stuff from any other thread will lead to the problems you're seeing, and more. This applies to both WPF and WinForms.
|
|
|
|
|
Please help me on this .... its very urgent and trying from last 10 days, otherwise tell me how save the file directly to disk using web browser control.
|
|
|
|
|
You can't do it directly. Check the documentation[^] to see which methods or properties can get the page content. My guess would be one of the DocumentXxx properties.
Veni, vidi, abiit domum
|
|
|
|