|
Bernhard Hiller wrote: But I still do not understand why I have to pass a Rectangle instead of a Point .
You'd have to ask Microsoft about that!
But it's probably because it's not something you logically want to do: locking a single pixel isn't going to be more efficient than GetPixel / SetPixel. Logically, you want to access a rectangle (which will be the whole bitmap often as not) rather than a single dot.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Not to challenge, but to ask, but isn't LockBits a GDI+ call and nothing to do with .NET and hence garbage collection?
Regards,
Rob Philpott.
|
|
|
|
|
Challenge away!
That's not how it was explained to me, but a quick look through the reference sources says you're right: it's just a wrapper for a call to GDI+
Interesting...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
string[] s = data.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
what does it mean?
|
|
|
|
|
It means that the Split method is invoked on the data class, with a new string array as parameters (containing only a newline), without any additional options (like removing empty items from the array), and assigning the result to a string-array called s .
There are easier ways to learn a language than by copy/pasting the parts you don't recognize. I'd recommend Head First C#
--edit; forgot a closing tag
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Take a string and split it based on any new lines in it. Can I suggest that now would be a good time for you to:
a. Invest in a basic C# book - your questions have all been very basic so this leads me to suspect you have no experience in the language
and
b. Learn how to Google - again, your questions could all have been answered with a quick search.
This space for rent
|
|
|
|
|
I already showed you where to look for this sort of information. Please make an effort to do your own studying and research.
|
|
|
|
|
There's a IntelliSense-description for every standard .NET method which Visual Studio will show to you when you type the opening bracket.
There's the MSDN online documentation which you can easily invoke by placing the cursor onto the class or method name in question and pressing F1.
And here's a good, free PDF-book on programming in C#:
Introduction to Programming with C# / Java Books[^]
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
It means that you need to read C# documentation and learn to use Google !
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Simple. Just input a string and split it with new line with no special split options like 'RemoveEmptyEntries' (The return value does not include array elements that contain an empty string)
Find More .Net development tips at : .NET Tips
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
what is the difference between "string data = sp_gsm.ReadExisting();" and "string data2 = sp_rf.ReadLine();"
|
|
|
|
|
|
how do I find the execution path of C# code using antlr for AST generation
|
|
|
|
|
Sorry, no idea. This is the C# forum.
|
|
|
|
|
what does "cmd.ExecuteNonQuery();"mean?
|
|
|
|
|
|
It means your SQL command string doesn't return any SELECT information: it's an INSERT, UPDATE, or similar instead.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
0
down vote
favorite
I was able to serialize a List of objects (List) using this code:
public static string Serialize(object obj)
{
using (MemoryStream memoryStream = new MemoryStream())
using (StreamReader reader = new StreamReader(memoryStream))
{
DataContractSerializer serializer = new DataContractSerializer(obj.GetType());
serializer.WriteObject(memoryStream, obj);
memoryStream.Position = 0;
return reader.ReadToEnd();
}
}
However, I'm not able to deserialize using this code:
public static object Deserialize(string xml, Type toType)
{
using (Stream stream = new MemoryStream())
{
byte[] data = System.Text.Encoding.UTF8.GetBytes(xml);
stream.Write(data, 0, data.Length);
stream.Position = 0;
DataContractSerializer deserializer = new DataContractSerializer(toType);
return deserializer.ReadObject(stream);
}
}
I'm not able to understand the problem. I'm using the last method by calling it with:
Deserialize(SerializedObject, List), but I'm getting an error saying List<FilesToProcess> is a type, which is not valid in the given context
Could anyone help? I'm a bit over my head with this.
|
|
|
|
|
Sooo, I have the doubtful honor of answering my own question.
The problem was that I was trying to assign the output of
`public static object Deserialize(string xml, Type toType)`
to a List<filestoprocess> generic called listOfFiles, when I should have assigned to an object and then cast to a `List<filestoprocess>` using
List
|
|
|
|
|
Hello
I need a project about convert of bonary to decimal and vice versa in C#
Modify the calculator by method project to convector of Binary to Decimal and vice versa.
The user should be only able to enter the 1 and 0 in binary textbox, and decimal numbers in decimal textbox.
modified 4-May-16 1:28am.
|
|
|
|
|
Member 12077780 wrote: I need a project about ...
Then I suggest you start by designing the user interface and working out exactly what you need to do with it.
We aren't here to do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
What have you done ? What is your problem , Where ?
Show your code.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Member 12077780 wrote: Modify the calculator by method project to convector of Binary to Decimal and vice versa. Are you sure it's decimal that you want to convert to, or is it convert between binary and integer (decimal means something different in .NET)? The solution you develop will be quite different depending on the answer to that question. Also, what is the underlying technology? Constraining input on a TextBox in a WPF application would be a lot different to doing the same in an ASP MVC application.
This space for rent
|
|
|
|
|
You will need to write the project yourself however there is a lot of code out there to help you. Here are a couple of things I wrote 8 years ago that may assist...
This article[^] deals with binary/int and other conversions too.
This article[^] deals with a numeric text box - you can modify to only allow 0 and 1 if in binary mode.
|
|
|
|
|
Consider:
using System;
using System.Drawing;
using System.Windows.Forms;
public interface IViewModel
{
string VName { get; }
Action<Control> VMouseDown { set; get; }
}
public interface IControl : IViewModel
{
new Action<Control, Point> VMouseDown { set; get; }
}
public class MyStupidControl : IControl
{
public string VName { get; private set; }
public Action<Control, Point> VMouseDown { set; get; }
Action<Control> IViewModel.VMouseDown { set; get; }
} Where my brain is failing is ... I keep thinking there's a way to avoid having to do the explicit definition of the 'VMouseDown defined in the 'IViewControl interface ... in the Control that inherits from 'IControl
Perhaps what I am "missing" here is the need to create an abstract class that functions as man-in-the-middle semantic structure between 'IViewModel and 'IControl ?
Or, maybe I've just discovered (yet) another thing I never understood properly about Interfaces in .NET ?
thanks, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|