|
leppie wrote:
You would have to instanciated an IChalk object to use an IChalk object. Remember the type of the IChalk object will not be IChalk, it will be the actuall type of the class
His point (and a good one) is that he shouldn't have needed to instantiate any object that implements IChalk in order to call Deserialize, by itself Deserialize doesn't need any state at all to operate (since it only creates a new instance of that object and returns a reference as the interface).
I think the class factory pattern would apply well here, have a class/interface that deserializes and creates new instances of objects implementing IChalk.
interface IChalkFactory
{
IChalk Deserialize();
IChalk Create();
void Serialize(IChalk);
} James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Tanka! Maybe your explaination made more sense than mine did. I have to say the inability to add static members to an interface is quite irritating. Ugh...
So many missing pieces...
|
|
|
|
|
Hi,
I have installed the Enterprise developer version after
uninstalling the beta version of Visual Studio .NET.
The problem is that now I can't execute any application
from the Begin button, neither debugging step by step; it
doesn't matter either the size and number of forms of the
project. In all cases when the form should be shown the
IDE hangs up like if the window shown was disabled. I can
close the application process and the IDE seems to recover
but keeps on hanged up. At the and I must close de IDE
process.
I uninstalled SourceSafe (I installed VS.NET & SourceSafe
at the same time) but nothing changed.
Does anyone knows what is happening and why?, any similar
problem?
Thanks in advance,
Edgar
Edgar Berengena Moreno
Software Engineer
Appeyron Research
|
|
|
|
|
|
Does it just sit there doing nothing or is it really hung (ie responds to nothing)?
For me in about 15 of 100 runs it will stop execution after loading System.Drawing.dll
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
well - im not 100% sure, after a long time the debug bar appears, but still the app does not show, so I just end the process for the app, and the IDE returns to normal.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
.NET service pack 2.
And I swallow a small raisin.
|
|
|
|
|
Thanks for your reply.
I have already installed it on my computer but keeps on hanging up...
Any other suggestion?
Edgar Berengena Moreno
Software Engineer
Appeyron Research
|
|
|
|
|
|
I had problems with SmartHelp and IDE, dunno if this is related.
Format is allways a solution
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
this is a known problem with vs 7.0, it is not fixed in sp1 pr sp2, there are steps to help the problem but to be honest i can't remember what they are (sorry).
if you post your problems to the microsoft.public.dotnet.languages.csharp newsgroup you will get a lot of help there.
I get it about 4 times out of 10, but I get usually get it to work by clicking the restart toolbar button.
I vaguely remember it also helps if you don't use your system to host a web dev stuff (asp), stopping some of the services on your machine to do with this helps, although it never fixed mine as I don't use the machine for asp stuff.
There is also some stuff on msdn/technet aboput the problem as well.
sorry I couldn't be of much help.
bg
|
|
|
|
|
Our group has encountered the same problem. We have found two things that will "un-hang" the IDE.
1. Disconnect your network connection (I have created a short-cut to enable/disable the connection).
2. Run the NET configuration utility (don't know why this works but it does).
|
|
|
|
|
EdgarBM wrote:
after
uninstalling the beta version of Visual Studio .NET.
Before you installed VS.NET did you make sure to remove all traces of the beta?
Chances are mscoree.dll was still lying around somewhere on your hard drive and that could have screwed some stuff up.
FWIW, when you got the Beta package there were several warnings about not being installed on a primary computer because the recommended way of switching from a beta is to format and reinstall. Fortunately the uninstall actually worked starting with RC0
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I've got the solution!
Thanks in advance to everybody who tried to help in anyway.
The solution is to recover a bug on the uninstallation program of the Beta version, it's all explained on:
Q312115 - PRB: Visual Studio Debugger Stops Responding After You Install Post-Beta 2 Build
It's about a service called ".NET Framework Support Service" which is not removed during the uninstall and produces all this problem. You must only to disable it and reinitialize the computer (find it at the Control Panel - Administrative Tools - Services, and disable it through Properties window).
Thanks to everyone.
Edgar
Edgar Berengena Moreno
Software Engineer
Appeyron Research
|
|
|
|
|
In the good old days, when I wanted to associate data structures with a combo-box item I'd use SetItemData.
What is the best method to do this in C# as I can't seem to find a SetItemData method. (Why has MS decided to remove a valuable, tried and tested way).
I must be missing something, I've been through the docs on ComboBox.ObjectCollection but it isn't making sense.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
i had to do the same thing with my ListEx[^] class, but wasnt sure how to do it. TO get around it, i made an ArrayList, and made a function as part of the class Add that added the relevant information to the Items collection, and also added a stuct of data to the ArrayList.
The position of the struct data in the ArrayList, corresponds to the position of the Item in the Items collection.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
That's a little too hack and slash for my tastes. Especially when sorting, removing and inserting are taken into account.
The ListView control uses the Tag property, but I can't find a way of doing the same for combo-boxes.
This is very annoying, seeing much used functionality being deprecated by .NET
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
|
Make the object you want to associate with the list item override the ToString() method. In ToString(), write code that will spit out the string that represents that object in the list box. Then just add your objects to the list (or combo) via the Items.Add() method. Then use the list (or combo)'s .SelectedItem property to get a reference to the object that is selected.
--
Russell Morris
"Have you gone mad Frink? Put down that science pole!"
|
|
|
|
|
Cool solution. I like it.
A little more work than SetItemData used to be, but it is the best idea so far. Thanks.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
I am trying to use some functions and structs from Shell32.DLL in my C# project. I have VS create a RCW by adding the COM DLL to my project references. However, after doing this I can only see the Classes, Interfaces, and Delegates from the DLL; I can not see the functions or structs. (Or any of the other NON-CLASS related items)
I understand I can use DllImport to extern the functions I want, but I could not figure out how to use DllImport to extern the Structs I want.
I do not care which method I use to gain access to the features I want of this DLL. If anyone can point me in the right direction, or just flat out let me know how to do what I want.
Thanks in advance…
Aalst
|
|
|
|
|
Well you'll have to code the structures by hand, below is an example
using System;
using System.Runtime.InteropServices;
namespace OSInfo
{
class Class1
{
[ StructLayout( LayoutKind.Sequential )]
public class OSVersionInfo
{
public int dwOSVersionInfoSize;
public int dwMajorVersion;
public int dwMinorVersion;
public int dwBuildNumber;
public int dwPlatformId;
[ MarshalAs( UnmanagedType.ByValTStr,
SizeConst=128 )]
public String szCSDVersion;
}
Each unmanaged DWORD corresponds to a managed int. The embedded fixed-length string TCHAR szCSDVersion[128] must be marshaled by value. The MarshalAs attribute can set the type of string marshaling to use as well as the length of the string. The most appropriate unmanaged type for this case is ByValTStr, which was designed specifically to be used for in-line fixed length character arrays that appear within a structure.
Note the StructLayout Attribute and the MarshalAs Attributes. You'll need to refer to MSDN to find out which UnmanagedType you need to Marshal you Data Members as.
Hope this helps.
May the Source be with you
Sonork ID 100.9997 sijinjoseph
|
|
|
|
|
This answer is great and fine. It deserves a good article on CodeProject, since I believe many people are going to get caught by this marshalling frenzy.
Btw, the MSDN doc completely sucks about this topic. It is barely a reference for internal MS people,
And I swallow a small raisin.
|
|
|
|
|
Agreed.
I think I have an easy solultion.
When defining structs , use the Platform Invoke Types table, but DWORD dont have to be uint like WORD dont have to be ushort, all u need to make sure is the width (bit size) corresponds to c++ unmanaged width.
EG: DWORD is 32bits wide, so u can use uint or int, whatever suites your needs. Int seems to be the prefered for DWORD and short seems for WORD. This seems logical as unsigned intergers will just require alot of extra casting.
However, I am not so sure about return values from functions e.g BOOL , which is 32bits wide, but i'm not really sure about the width of a Managed Boolean.
Hope this helps.
PS: Anyone who has some good experience with this might wanna write a comprehensive article for us C# only dummies .
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
What users would really love to see IMHO is a table with a mapping between C types (BOOL, HWND, DWORD, LPSTR, BSTR, SAFEARRAY, ...) and the corresponding managed type,
And I swallow a small raisin.
|
|
|
|