|
I have 10 different assembilies, I want to put it in One Library file or one assembly, cause I don't want to add references upto 10 times everytime for my different screen. Is anybody know how to do that.
Thanks in advance
|
|
|
|
|
Try putting them all in one project.
|
|
|
|
|
I have to use xml transformation.
The simplest way is
<br />
XslTransform xsltransform = new XslTransform();<br />
xsltransform.Load("favorite.xsl");<br />
xsltransform.Transform("MyDocument.xml", "TransformResult.xml");<br />
But it is necessery for me to put output of transformation not to file but to string... (all of overloaded members of Transform has file or stream)
Do you have any idea?
|
|
|
|
|
tomiga wrote:
(all of overloaded members of Transform has file or stream)
You could create a memory stream to house the output of the transformation; then once the transformation is done convert the underlying byte array to a string.
System.Text.(Encoding).GetString(myByteArray) if the XML file uses ASCII then (Encoding) should be ASCIIEncoding; if it uses UTF8 then it should be UTF8Encoding; etc...
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thx. I have found stream witch writes output to string. StringWriter class. It helps me to solve problem.
|
|
|
|
|
Is there any way I can pass something back from a function so that it can be a string, or a number, or some other value, like a variant in COM ? I don't want to pass an object, because it's too much work for my client to try and figure out what it is. Is that my only option, apart from GetNodeInt/GetNodeString/etc. ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
One option other than an object that I can think of is to use very inspecific variables. So if you know that you're going to pass either a byte, an int, or a long, use the long.
You could also try converting everything to and from a string, but that might be more work than the object.
A third option is to pass a type variable. That way you can create a switch for all of the types that might be returned.
Hope this helps
|
|
|
|
|
SHaroz wrote:
A third option is to pass a type variable. That way you can create a switch for all of the types that might be returned.
That sounds very promising - could you tell me more ?
Thanks
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I'm not entirely sure if this is more efficient than just passing an object or if I'm even implementing this correctly. You should try timing how long it takes this to be done 1000 times vs. just passing the object. Anyway, I hope this helps:
private object ASDF(ref System.Type T)
{
Boolean myVar;
T = myVar.GetType();
return myVar;
}
private void myTestFunction()
{
System.Type X;
Object temp = ASDF(X);
switch (X)
{
case Int:
Int myInt = (Int)X;
break;
case Boolean:
Boolean myBool = (Boolean)X;
break;
//...
case Object:
//it is an object
break;
}
}
|
|
|
|
|
C# .NET question
My first and main question is: Can C# produce native executables, that would run on any Windows
platoform without the .NET binaries? Just like C++? Or it only compiles to bytecode like Java?
(it doesn't matter how MS calls it?)
Do you think that C# is good for Graphics Applications? (I mean is it fast enough)
I would like to try .NET SDK and online documentation before I move to VS .NET. Do you know
about any online books on C# (beside C# Language Specification and Thinking in C#)?
I think a FAQ on C# would answer this question but so far I couldn't find any with the anwsers I
want.
Any help is appreciated. Thank you,
Z.
|
|
|
|
|
Zimbar wrote:
My first and main question is: Can C# produce native executables, that would run on any Windows
platoform without the .NET binaries? Just like C++? Or it only compiles to bytecode like Java?
no, c# does not compile to a win32 executable.
Zimbar wrote:
Do you think that C# is good for Graphics Applications? (I mean is it fast enough)
except for very extreme examples ( like maybe a game engine or something ), c# will be fast enough.
|
|
|
|
|
Zimbar wrote:
My first and main question is: Can C# produce native executables, that would run on any Windows platoform without the .NET binaries?
No, the C# compiler only compiles down to MSIL bytecode.
Zimbar wrote:
Do you think that C# is good for Graphics Applications? (I mean is it fast enough)
Probably not; but you could always try it to see.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Zimbar wrote:
++? Or it only compiles to bytecode like Java?
That is sort of right. But yes, you need the runtime.
Zimbar wrote:
Do you think that C# is good for Graphics Applications? (I mean is it fast enough)
No. My graphics filters were benchmarked by Chris L. and the same code in C++ was 25 times the speed. I wrote mine in C# only because I needed to, to differentiate them from some I wrote in C++ for a former employer.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
25x?
That seems surprising. Care to share a bit of code (both in C++ and in C#)?
|
|
|
|
|
My C# code is here on the site - I did not think the speed was too bad ( but I maintain C# is the wrong tool, mostly because Microsoft in their wisdom have made pixel access 'unsafe' ), but Chris Losinger has posted the question based on conversion to C++ that he did.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Two questions:
1) Was the code written using GetPixel and SetPixel()?
2) What other option was there besides making pixel access unsafe? I don't like it either, but I can't see how you can be fast without being pointer-based.
|
|
|
|
|
Anonymous wrote:
Was the code written using GetPixel and SetPixel()?
Mine was not, that would not be unsafe. I assume Chris' was not either - he writes an imaging library, you know.
Anonymous wrote:
What other option was there besides making pixel access unsafe? I don't like it either, but I can't see how you can be fast without being pointer-based.
The obvious option is a function that returns the bitmap as a 2D array. How do you think every array in memory is laid out ? There is no reason to regard it as unsafe to access the member data of the Bitmap class.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Sorry that the last one came across as anonymous. Not sure why...
Christian Graus wrote:
The obvious option is a function that returns the bitmap as a 2D array. How do you think every array in memory is laid out ? There is no reason to regard it as unsafe to access the member data of the Bitmap class.
Hmm. Did the C++ version use pointer arithmetic, or did it use array indexing? I agree that you can return a 2D array, but I don't that would help much in this case because:
1) multidimensional access in C# is a bit slower than single dimensional
2) Array indexing is slower than pointer arithmetic
3) The .NET classes are a thin layer on top of the unmanaged GDI+ functions. If you can't change that, then you'd have to copy from the unmanaged world to the managed world and back, which would be really slow.
#3 is a design decision which I hope can be addressed in the future. I'm not sure what we'd do to address the others.
Thanks for the info; I'll take a look at the code.
|
|
|
|
|
Eric Gunnerson (msft) wrote:
Did the C++ version use pointer arithmetic, or did it use array indexing?
Pointers, for speed. I appreciate all that you are saying, my point is more that C# should be able to access the bitmap data in one call, instead of using get/setpixel which is notoriously slow, and without having to write code that will be marked 'unsafe'. Ideally, I guess that means GDI+ should provide another call, or C# should sandbox the GetData call and return the data. This will be slower, of course, but I would not mind that if I had the option to go unsafe, but could do pixel access in some way that was as optimised as I could hope for without marking my code as unsafe.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I looked at the code, and it pretty much looks like my code.
Is there anyplace I can look at the equivalent C++ code that Chris timed?
|
|
|
|
|
If you installed vs.net, you can find C# language sepecification document on VC# folder, and also you can find many resource on msdn online.
I'm amumu, and you?
|
|
|
|
|
Hello All,
I have a component (say AManager) managing a set of custom controls (say AView) as standard collection on .NET form.
A property of the AManager (Views) displays the collection editor dialog with the "Add" and "Remove" buttons.
Now, the problem is, the "Add" button adds a new AView object to the collection and the necessary code is generated in the Form file. However, the code which will add the custom control to the form is not generated and therefore the control does not appear on the form. I had to manually update this part.
ie. the following line in the form source is not updated
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.customControl12,
this.customControl11});
when I use the collection editor to add customControl13 to the collection. So, I have to manually add the line as:
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.customControl13,
this.customControl12,
this.customControl11});
Any help? Am I missing some attributes?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
How do I iterate through a collection while modifying it?
Let's say I have a hashtable I want to clear one entry at a time. I might want to retrieve an object from the table and do something with it before I remove it.
I can not use the foreach statement on the dictionary entries in the table without getting an exception. I've understand that enumerators work the same way. The remove method is no good either since it does not return what it removes.
How can I solve this problem as easily as possible? Any hints would be much appreciated.
Thanks!
|
|
|
|
|
J. Ehrnström wrote:
I can not use the foreach statement on the dictionary entries in the table without getting an exception. I've understand that enumerators work the same way.
Actually that is the same thing Underneath it all foreach just uses enumerators to iterate through the collection.
What I would do is to get the collection of keys, then iterate through that; to remove what you need to.
Hashtable table = .....;
object [] keys = new object[table.Keys.Count];
table.Keys.CopyTo(keys, 0);
foreach(object key in keys)
{
object obj = table[key];
} HTH,
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thanks for your quick reply. I tried your solution and it worked just fine.
I actually did think about adding the keys to their own list using an ArrayList, but that list would only have referenced the original keys, so the problem would have remained. You solved that problem by explicitly copying the keys.
Thanks again!
|
|
|
|