|
Thanks Senthil,
Does it mean all value types of C# will be boxed to Object?
regards,
George
|
|
|
|
|
George_George wrote:
Does it mean all value types of C# will be boxed to Object?
Yes.
|
|
|
|
|
1)
Yes, the restriction exists in C# , not in the runtime.
2)
No delegates are nice.
But in C# they look like they are something different , c# provides special support for delegates.
while at CIL level, they are just classes that inherits from Delegate
|
|
|
|
|
Thanks Roger,
1. All value types are inherits from ValueType, and ValueType is inherits from Object, correct? I can not believe int and long are also inherits from ValueType/Object?
2. What do you mean "But in C# they look like they are something different , c# provides special support for delegates."? Any more description please?
regards,
George
|
|
|
|
|
George_George wrote: I can not believe int and long are also inherits from ValueType/Object?
Why? They are also equivalent to struct s, so why should they be any different?
If you've haven't already done it, download and install Reflector[^]. It allows you to disassemble .NET assemblies, including the framework ones - look for System.Int32 and sure enough, you'll find that it inherits from ValueType.
|
|
|
|
|
Thanks Senthil,
Your reply is clear. One further question, I think for primitive types, there are pairs of relationship, example int and Int32 are the same thing, only different in names. Is my understanding correct (I can not find answers from any books or search)?
regards,
George
|
|
|
|
|
George_George wrote: One further question, I think for primitive types, there are pairs of relationship, example int and Int32 are the same thing, only different in names. Is my understanding correct (I can not find answers from any books or search)?
Yes, int is just an alias for System.Int32, uint for UInt32 and so on. The C# compiler translates the names to the appropriate .NET datatypes.
|
|
|
|
|
Thanks Senthil,
Great to learn from you. So, a final confirmation, Object is the root for all value types (including primitive value types and user defined struct value types), and for all reference types, right?
regards,
George
|
|
|
|
|
George_George wrote: We can not inherit one value type from another, for example, we can not make a struct inherit from another struct; -- I think it means there is no inheritance or derivation for value types.
Yes. Value types are not possible to inherit. You can use interfaces and implement it on a structure though.
George_George wrote: All value types are inherits from ValueType, and ValueType is inherits from Object, seems value types could have inheritance or derivation?
Do you know System.ValueType is a class ? Not all value types are inherited from System.ValueType . There are some built in value types like integer. When you write a structure, it will be inherited from System.ValueType .
|
|
|
|
|
|
I have a Form with a Panel mainBackPanel. To mainBackPanel I add different panels say redPanel, greenPanel, bluePanel depending on key pressed, r, g, b respectively. Each panel has a different image (say tomatoes, trees, sky) and a transparent label.
Now when the panel changes, I see a small flicker on the area covered by the label.
mainBackPanel (to which the individual panels are added) is double buffered.
The code, in .NET 2.0, can be found here[^].
You will need to put 3 image files namely fb.jpg, mf.jpg and pl.jpg in bin/debug folder prior to running the app.
Please suggest how to get rid of the flicker.
Thanks
Sukhjinder
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
Before you do any processing on the images, use SuspendLayout[^] and when you're done use ResumeLayout.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
All KeyEvents are being handled by MainForm in the following method
void mainFormKeyUpHandler(Object o, KeyEventArgs kev)
{
if( kev.KeyCode == Keys.R )
{
this.mainBackPanel.Controls.Clear();
this.mainBackPanel.SuspendLayout();
this.mainBackPanel.Controls.Add(this.mainFormPanel);
this.mainBackPanel.ResumeLayout();
}
else
.
.
.
}
<br />
<br />
But the result is still the same. <br />
<br />
<div class="ForumSig">Looking for help on my OpenSource Media Player <a href="http://sukhjinder.cn/letsyo/contribute.html">LetsYo</a></div>
|
|
|
|
|
Move that suspend before Controls.Clear() as that may also cause some flickering. Might solve it for you.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Tried that too. It doesn't work.
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
I searched the web and found many people having similar problems. Typical scene is you remove a control and add a new one. This causes a flicker. I searched the Internet and found some potential solutions but couldn't understand them much. Can you help me with it?
Solution #1[^]
Solution #2[^]
Solution #3[^]
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
Hi.
i'm developing an application in c#.
The first part is a typical application with forms, database queries, etc...
In a second phase, i need to design a panel with several buttons, with different captions, each button represent a complex vector shape with textures, for example a table, a computer, a tv...
When the user clicks on a button, a shape appears in a canvas. The user can drag and drop the shape and resize it.
If the user resize the shape, the texture must auto-adjust to the new size (tile effect).
In addition, it is necessary to implement a collision detector, to prevent "illegal positions".
f.e.: The table only can be placed in the floor and the tv only over the table, etc..
I need to chose an option (WPF, DIRECT2D, GRAPHICS CLASS ...)
1. ¿What option you recommend me?
2. Someone knows open source libraries or similar examples?
Thanks in advanced and sorry for my basic english
|
|
|
|
|
i am using the following code
System.IO.File.SetAttributes(Environment.GetFolderPath(
Environment.SpecialFolder.Cookies ).ToString(), FileAttributes.Normal);
DirectoryInfo directory = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Cookies));
if (directory.Exists)
DeleteFiles(directory);
public void DeleteFiles( DirectoryInfo directory)
{
FileInfo[] info = directory.GetFiles();
foreach (FileInfo file in directory.GetFiles())
{
try
{
System.IO.File.SetAttributes(file.FullName, FileAttributes.Normal);
file.Delete();
}
catch (Exception ex)
{
}
}
foreach (DirectoryInfo dir in directory.GetDirectories())
{
try
{
DeleteFiles(dir);
}
catch (Exception ex)
{
}
}
}
This code is deleting all files in the Cookie folder but the problem is index.dat file remains there it gives error
Used by another person or program
What should i do to delete that file
Thanks
|
|
|
|
|
index.dat is a system file and should not be deleted.
Find out more here
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Obviously they will, when you visit a website that uses them. However, your questions was about deleting index.dat, which has nothing to do with the cookies.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
You can use windows API to delete all the cookies.
The functions below are useful:
FindFirstUrlCacheEntryEx, FindNextUrlCacheEntryEx, DeleteUrlCacheEntry.
They are defined in wininet.dll.
|
|
|
|
|
Hey guys
i need to run external console programs from within a console program... this i can do but the snag comes in were i have to wait for process1 to finish before i start process2
heres what i have
static void Main(string[] args)
{
ProcessStartInfo process1 = new ProcessStartInfo("ring.exe");
Process.Start(process1);
ProcessStartInfo process2 = new ProcessStartInfo("ringLouder.exe");
Process.Start(process2);
Console.Read();
}
any ideas?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Ive now seen that when the process class is used as an instance there is a WaitForExit() method
but now i'm getting an error on myProcess.Start("ring.exe"); " System.Diagnostics.Process.Start(string)' cannot be accessed with an instance reference; qualify it with a type name instead "
here is the code
Process myProcess = new Process();
myProcess.WaitForExit();
myProcess.Start("ring.exe");
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
try use the following
//Wait for window to finish loading.
process1.WaitForInputIdle();
//Wait for the process to exit or time out.
process1.WaitForExit(5000);
.....
|
|
|
|