|
Thanks N a v a n e e t h,
1.
So, no way to know which CLR version is used from outsire?
2.
Have you found any documents saying Windows Service will always use latest CLR version other than the CLR version used to build it?
3.
N a v a n e e t h wrote: .NET Framework 3.5 uses CLR version 2.0
-- confused about this, you mean for the common parts between 2.0 and 3.5, like System.XXX and Net.XXX classes, they share the same binary code?
regards,
George
|
|
|
|
|
George_George wrote: Have you found any documents saying Windows Service will always use latest CLR version other than the CLR version used to build it?
I haven't been able to find the documentation I saw this in, but it has to do with the way certain unmanaged applications (like IIS, SQL, DLLHost, etc.) actually host an instance of the .NET runtime. I'm still looking, so if I find the information I'll update the post.
George_George wrote: So, no way to know which CLR version is used from outsire?
Not really, no. You could use a tool like ILDasm to inspect the PE header and manifest metadata, which will tell you what version of the CLR the binary was compiled against, but that isn't really going to tell you what version you may be running on. Are you asking because you are running in to a problem or is this just a "want to know" type of question? If you're running in to a problem, posting what that problem is may help get you the right information to resolve it.
George_George wrote: confused about this, you mean for the common parts between 2.0 and 3.5, like System.XXX and Net.XXX classes, they share the same binary code?
The thing to keep in mind here is that NetFx v3.0 and NetFx v3.5 are really a set of framework libraries (WPF, WCF, WF, Linq, etc.) that extend the runtime engine (the CLR) which is CLR v2.0. (This simplifies things a bit, since there are actually service packs that are distributed as part of NetFx 3.0 and 3.5 that are mandatory and irreversible once installed.)
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Thanks Scott,
Scott Dorman wrote: The thing to keep in mind here is that NetFx v3.0 and NetFx v3.5 are really a set of framework libraries (WPF, WCF, WF, Linq, etc.) that extend the runtime engine (the CLR) which is CLR v2.0. (This simplifies things a bit, since there are actually service packs that are distributed as part of NetFx 3.0 and 3.5 that are mandatory and irreversible once installed.)
So, for the common parts of library, like System, string, sockets and http related classes, they are common in 2.0/3.0/3.5 correct?
regards,
George
|
|
|
|
|
George,
There has always been some level of confusion regarding the differences between Framework (Fx) versions, CLR versions, and language versions. Here is a brief explanation up through VS2008 (.NET Fx 3.5): http://geekswithblogs.net/sdorman/archive/2007/06/12/Visual-Studio-2008.aspx[^]
As for retrieving the CLR version your process is using from inside your process the only real option is to add a call to Environment.Version.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Thanks Scott,
1.
From document you referred, I learned .Net Framework is the library, and CLR is used only for the runtime engine, manages the libraries, correct understanding?
2.
Do you have any document mentions for Windows Services, the lastest version .Net Framework other than the version used to make the build is used please?
regards,
George
|
|
|
|
|
George_George wrote: manages the libraries
.NET framework is a collection of classes, ofcourse a library. Common language runtime is the runtime where these libraries are executed.
|
|
|
|
|
Thanks N a v a n e e t h!
A further question -- "Do you have any document mentions for Windows Services, the lastest version .Net Framework other than the version used to make the build is used please?"
regards,
George
|
|
|
|
|
My problem is:
I have 3 main classes A, B and C (B and C are derivated from A)
I have a generic class F
And I have derivated F to work with B and C:
class FB : F<B>
class FC : F<C>
Now, in my main application I have a method that should work with FB and FC (also with any F<> that uses a A derivated type as parameter)
I tried to do this, but it doesn't compile:
void WorkWithData(F<A> data) {}
FB testB = new FB();
FC testC = new FC();
WorkWithData(FB);
WorkWithData(FC);
Is there anyway to fix it?
Thanks,
Dirso
|
|
|
|
|
With the current state of C# (and VB), that sort of thing is not possible. Apparently the CLR supports this sort of assignment (known as covariance and contravariance), but the C# and VB language teams decided not to implement it yet.
A decent series of blog posts that talk about the topic can be found here [^]
|
|
|
|
|
A suggested, have a google for covariance and contravariance. This is supported in some cases, if the type parameter is used in a read-only manner. IEnumerable<t> can be used covariantly, IList<t> can't.
You can make it work by declaring your method as:
void WorkWithData<t>(F<t> data) where T : A { ... }
The compiler may infer the appropriate specialization of WorkWithData for you. If not you'll have to call it like WorkWithData(testB);
|
|
|
|
|
Hi,
What is the fastest way to convert string array to double array? Currently, I am doing this:
double[] arrDouble = new double[arrString.Length];
for(int i=0; i<arrString.Length; i++)
{
arrDouble[i] = double.Parse(arrString[i]);
}
Unfortunately, this is quite slow for big array (about 3 millions). I am looking for a way to improve it. There is a link talking about converting object to double. http://blogs.msdn.com/bclteam/archive/2005/02/11/371436.aspx[^].
You will see that double.Parse is really slow because the object need to be converted to string before pass it to double.Parse. However, it is not the case here. My array is already a string array. I did test using Convert.ToDouble and it doesn't improve the speed.
Any idea?
Thanks for any help.
Cheers
|
|
|
|
|
This will always be a O(n) operation, you can't get it any faster than this. Are you sure you need 3 million items at the same time?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yeah, unfortunately
Thanks though for your help. At least I know there is nothing I can do about it.
Cheers
|
|
|
|
|
Just for curiosity. How long does it take to convert those 3 million items?
|
|
|
|
|
12 years later and we still haven't heard back. I can see why they wanted to speed this up.
|
|
|
|
|
I'm trying to do an drag and drop example but it failed.
my code is:
public partial class Form1 : Form
{
private String f;
public Form1()
{
InitializeComponent();
f = "D:\\Special";
String[] files = Directory.GetFiles( f );
foreach ( String fi in files )
{
listView1.Items.Add( fi );
}
}
private void listView1_ItemDrag( object sender, ItemDragEventArgs e )
{
DoDragDrop( new DataObject( DataFormats.FileDrop, ( ( ListViewItem ) e.Item ).Text ), DragDropEffects.Copy );
}
}
Please help me, it's very urgent.
|
|
|
|
|
Check out this article[^].
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Thank you for it, but I've already read it, and I did the same but it didn't work with me, that's why I'm so confused.
|
|
|
|
|
HI..
Im trying to move mails that have come into my inbox, that have a specific subject into a subfolder in my inbox. Im trying to do this using a c# application. Ive been working on this the whole day, cant seem to get it.
Also whenever i use the Folder.Folders methods i get a 'Microsoft.Office.Interop.Outlook.MAPIFolder.Folders' is a property but is used like a method error. this is how i use it:
Subfolder = namespace_.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).Folders("Requests");
Thanks
|
|
|
|
|
Change
Subfolder = namespace_.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).Folders("Requests"); to
Subfolder = namespace_.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).Folders["Requests"];
|
|
|
|
|
Thank you!!! IT WORKS.. IT WORKS.. IT WORKS.
been struggling with it for days.
heres why i needed it: i have a web app which sends 'requests' these requests are than saved to a database and sends an email to the administrator notifying them that a new request has come in.
now the problem was that in my desktop app i used a timer to check inbox every couple of seconds.. and each time it would read the same message and say there is a new messge. so just wanted to move the request into their own folder so that when the inbox is checked there shouldnt be any new request as they would be in their own folder.
didnt want to mark them as unread!!
(hope this makes sense ).
|
|
|
|
|
It does make sense. Could you not have used an Inbox rule to accomplish the same thing?
|
|
|
|
|
if i were using an inbox rule.. wouldnt i have had to go directly into outlook and make the rule? if so, thats what i was trying to avoid! whats the point of coding than? just wanted everything to be done without me going into outlook.
|
|
|
|
|
My bad - for some reason, I was thinking you could do this with Exchange - but I can't find anything in there. Oh well - curse my faulty memory.
|
|
|
|
|
In .Net 2003 I'm creating a simple text editor app using a rich textbox, a menu, a status bar and a toolbar.
Inside the Windows Form Designer generated code, it errors on this line
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
with the message
An unhandled exception of type 'System.Resources.MissingManifestResourceException'
occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture
(or the neutral culture) in the given assembly. Make sure "Form1.resources" was correctly embedded
or linked into assembly "Editor".
baseName: Form1 locationInfo: Samples.Editor.Form1 resource file name: Form1.resources assembly: Editor,
Version=1.0.3160.18184, Culture=neutral, PublicKeyToken=null
The toolbar gets its images from the ImageList. This was alll working up until a few moments ago. I changed a method relating to saving the file, and when I ran it again, it errored.
All the images are missing out of the image list. If I leave them out and run it, it works fine. If I readd the images and run it, it errors again.
Anyone know what it going on?
Everything makes sense in someone's mind
|
|
|
|
|