|
There is a set of IsXxx properties (e.g. IsPublic) but their mapping onto the C# keywords isn't really clear to me.
|
|
|
|
|
I know, I get public access modifier;
private string GetClassAccessModifier(Type pClass)
{
if (pClass.IsPublic)
return "public ";
}
But how can I get internal and private modifier.
Non exist following properties;
pClass.IsInternal
pClass.IsPrivate
pClass..IsAssembly
|
|
|
|
|
hi
i have 2 form in my program
publis object from form2 for example "Frm_User" that new in load of mainform and have a filed for example "AllowEdit"
i can access to this filed by Frm_User.AllowEdit
but i want to find a way that access "AllowEdit" by know name of this filed in other form
it mean that i want find a way to dynamically access obj of form2 "Frm_User" by Name and then change that field in mainForm
can any one help me
thnx
|
|
|
|
|
Have you tried casting the object?
If the object is different everytime and you can't edit the objects to use an interface with "allowEdit" then maybe you can try using "reflection" methods to get access.
Look up those things then ask for specific help.
|
|
|
|
|
i know with reflection we can access all property and method with the instance of the object
but my problem is i want to create instance of instance of the object from a string that contain name of that object
for example :
i know that object of from2 is "Frm_User" and string whith this code
string temp="Frm_User";
can i access the object of form 2 with temp?and change property and and field of that?
|
|
|
|
|
Have a look at Activator.CreateInstance().
|
|
|
|
|
You can probably, expose AllowEdit through a public property and set it from your code
love2code
|
|
|
|
|
Hi everyone!
I am a new one to DirectX. Now I want to draw a cube on Windows Mobile. The language I used is C#, and I want to use DirectX technology. I had already drawn every surface. These surfaces can be shown individual. But when I write these datas into a buffer altogether for showing all surfaces, only the first surface can be drawn. Other surface dispear. I don't know the reason. I hope someone could be kind to help me. Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
hi guys,
I need your help.
let's suppose I have Dual-Core CPU and I need know how to create two threads, each in different processor.
for example:
thread1 runs in 1core
thread2 runs in 2core
when implementing tread1.start(); thread2.start(); they both run some random function lake NumberTest();
Thanks in advance,
renven
|
|
|
|
|
Thread.SetProcessorAffinity()[^]
It appears as if threading in .Net already distributes multiple threads across all available processors/cores, so you don't appear to have to worry about it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Wednesday, December 23, 2009 10:49 AM
|
|
|
|
|
This is surely a better solution than mine! 
|
|
|
|
|
Then vote it a good answer.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Wait, re-reading carefully the documentation it seems that it is only for XNA and XBox360. I tried a small test program and the Thread.SetProcessorAffinity does not exist in the standard 3.5 .NET framework. Am I missing something obvious? 
|
|
|
|
|
You're right, and I changed my answer.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Sounds more logical too; imagine all applications dividing their affinity over two cores. You'd freak out if your computer has four cores, as two would be consistently ignored
The CPU-affinity can be set by the end-user over the task-manager, if there's a need to do so.
I are Troll
|
|
|
|
|
C# seems not to support the feature you are requiring, you should use some Interop to do it.
This snippet should do the work (I found it here[^], I didn't tested it.
class Program
{
[DllImport("kernel32")]
static extern int GetCurrentThreadId();
static void Main()
{
Thread t = new Thread(
new ThreadStart(DoWork));
t.Start();
t.Join();
}
static void DoWork()
{
foreach(ProcessThread pt in Process.GetCurrentProcess().Threads)
{
int utid = GetCurrentThreadId();
if (utid == pt.Id)
{
pt.ProcessorAffinity = (IntPtr)(1);
Console.WriteLine("Set");
}
}
}
} But why do you want to change the thread affinity? The scheduler should automatically take advantage of both CPU cores.
|
|
|
|
|
Hi,
don't worry about which processor executes which thread; setting processor affinities isn't necessary at all. If you let everything run without "helping" it, Windows will assign threads to processors dynamically (which means a thread once blocked for some reason might continue on another processor), with some retention as to preserve cache efficiency. It is only in very special cases that you could improve on the automatic assignment.
|
|
|
|
|
Hi All, I am trying to do some query in my sqlite database. I wanted to get average of some number, but could not do it.
if you please can, write a sql statement that get average of some number.
"SELECT AVE(w)FROM x WHERE y = z ";
It should return the ave of all w.
thanks in advance
|
|
|
|
|
This belongs to the "General Database" forum, this is the C# forum.
I suggest you post there and delete this post.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
jashimu wrote:
"SELECT AVE(w)FROM x WHERE y = z ";
This transact sql statement will be
"SELECT AVG(w)FROM x WHERE y = z ";
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
How do i change the title of the webpartzone.
It is keeping the ID of the webpartzone as the name
|
|
|
|
|
Ok. Good question, or, what the hell is a webpartzone?
|
|
|
|
|
use webpart in ASP.NET to drag and drop controls.
Webpartzones are the zones in which webparts are created.
My question how do you change the webpart zone name or even
remove the title of the webpart zone
|
|
|
|
|
Ah, so it's an asp.net question. Good, ask in the ASP.NET forum, you will get a (better) answer there.
|
|
|
|
|