|
I've never used Delphi, so I'm not sure how to read that exactly. There are basically two possibilities:
1. most likely
if the Delphi code is supposed to allocate and fill native memory with a result string, then what you are getting is really a pointer into the native world, and you must use one of the Marshal.PtrToStringXYZ() methods to get the corresponding managed string.
2. alternatively
if the Delphi code needs a pointer to an existing buffer it is supposed to fill, then you should replace the last but one parameter in the prototype and in the call by a StringBuilder instance, which must have been created (with new) and given sufficient capacity (the parameter in its constructor).
[ADDED]
If the native function wants stdcall, your prototype should say so, using CallingConvention=CallingConvention.StdCall within the parentheses of the DllImport attribute.
[/ADDED]
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
modified on Saturday, May 22, 2010 6:04 PM
|
|
|
|
|
How can use Peterson Algoritm For many Process?
|
|
|
|
|
These[^] might help.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
How can Write this In C#?
I want Sample CODE
|
|
|
|
|
shahramkeyboard wrote: How can Write this In C#?
I want Sample CODE
Then go to rentacoder.
The forums are here to help you with specific problems you have and not to provide complete applications for people. Can you possibly imagine how many requests for code we get each week? If we were to try and solve them for all the requests, we wouldn't have time to do anything else. Imagine, also, how long it would be before companies realised that they could get things done for free here just by posting a request for source code. Now consider how few the number of people are here who actively participate and offer help in the forums - there are less than 100 good coders offering advice in the forums; and, almost without exception, they are all professional developers - they have lives to lead outside.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
how can Simulate Of TSL instruction For Resolve of Race Condition?
i Want to Use Thread without Race Condition By Simulate TSL
how i can?
|
|
|
|
|
By reading some of these[^] links.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
How can Write this In C#?
I want Sample CODE
|
|
|
|
|
shahramkeyboard wrote: I want Sample CODE
Honestly, you sound like a spoiled child here. I want, I want, I want. I want Salma Hayek to come and towel me down with her hair after a swim in a deserted lagoon. I want to win the national lottery. I want to be a prize winning author. None of these are going to happen, so I don't go on whinging about it.
I assume you have some experience as a coder. Read the texts. Formulate an algorithm from this and come up with a design. Then write the code. Don't think you are going to get somebody else to do it for you - that's just being lazy.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
As the subject suggests, is it possible to store a List<someobject> in a SQL database using stored procedures or any other ADO.NET code?
|
|
|
|
|
|
I second that: yes yes.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Okay any tips on how to do this? Would I just pass it through as a single parameter and specify a data type? I only did a few google searches but it didn't help much. I'll keep searching though. Just a correction on my first post; I meant a generic List(T) (I know it's not supposed to be round brackets)
|
|
|
|
|
there probably is an infinite number of ways to do it, and maybe only a single good one.
you could serialize the List<T> to a stream, maybe an XML stream, and store that in a single field of your database. That stores the data, but makes it completely unavailable, until you read it all back into a list.
the one, structured, way to do it would take an entire table:
a List<T> contains objects of type T, which probably holds a number of data fields.
a database table holds a number of rows and columns.
hence each listed T instance should be stored as a row.
Etienne_123 wrote: I meant List and not just plain list
do you ever use the preview button, and fix what does not look right? you need to encode those < signs, otherwise they are interpreted like HTML here. There are some widgets to help you.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks I will use your comments. Yes I always use the preview button. That's why I said I know that 'T' shouldn't be in round brackets. I was in a hurry and wasn't sure how to encode those signs
|
|
|
|
|
Hi,
Does anyone know about a application like ".NET Reflector" that decompiles an entire DLL?
Thanks
|
|
|
|
|
Yes, it is called .NET Reflector.
AFAIK there is a plug-in that does that. I don't have details though, so try Google!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi every one,
I have created a class: student.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Assignmnet2
{
[Serializable]
public class ITECH3219Student
{
//definition of Class's Field
private string FirstName;
private string SurName;
private int StudentId;
private int LabsMark;
private int Assignment1;
private int Assignment2;
private int Final;
//defination of Class Properties
public string Fr_name
{
get { return FirstName; }
set { FirstName = value; }
}
public string Sr_Name
{
get { return SurName; }
set { SurName = value; }
}
public int St_Id
{
get { return StudentId; }
set { StudentId = value; }
}
public int Lb_Mark
{
get { return LabsMark; }
set
{
if (value > 0 && value <= 10)
{
LabsMark = value;
}
}
}
public int Ass1
{
get { return Assignment1; }
set
{
if (value > 0 && value <= 20)
{
Assignment1 = value;
}
}
}
public int Ass2
{
get { return Assignment2; }
set
{
if (value > 0 && value <= 20)
{
Assignment2 = value;
}
}
}
public int Fnl
{
get { return Final; }
set
{
if (value > 0 && value <= 50)
{
Final = value;
}
}
}
//define Constructor of Class
public ITECH3219Student(string Fr_Name, string Sr_Name, int St_Id, int Lb_Mark, int Ass1, int Ass2, int Fnl)
{
this.FirstName = Fr_Name;
this.SurName = Sr_Name;
this.StudentId = St_Id;
this.LabsMark = Lb_Mark;
this.Assignment1 = Ass1;
this.Assignment2 = Ass2;
this.Final = Fnl;
}
//define the class's methods
public bool Passed()
{
return ((LabsMark + Assignment1 + Assignment2) >= 25 && (Final >= 25));
}
//definition Grade property
public string Grade
{
get
{
int TotalMark = LabsMark + Ass1 + Ass2 + Final;
if (TotalMark < 40) return "F";
else if (((!Passed()) && TotalMark >=50) ||
(TotalMark < 50 && TotalMark >= 40))return "MF";
else if ((Passed()) && TotalMark < 60 && TotalMark >= 50)return "P";
else if ((Passed()) && TotalMark < 70 && TotalMark >= 60)return "C";
else if ((Passed()) && TotalMark < 80 && TotalMark >= 70)return "D";
else if (TotalMark > 80) return "HD";
else
return string.Empty;
}
}
//public static int CompareByName(ITECH3219Student x, ITECH3219Student y)
//public static int CompareByTotal( ITECH3219Student x, ITECH3219Student y)
public override string ToString()
{
return string.Format("Surname:{0}\nFirstName:{1}\nStudentId:{2:D6}",SurName,FirstName,StudentId);
}
}
}
I have anther class which suppose to insert data to a file through list.
The problem is whenever I am trying to add data I get thie error "invalid token '( ' in class struct or interface member declaration"
Class CreateEntry.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Assignmnet2
{
[Serializable]
class CreateEntry
{
ITECH3219Student student = new ITECH3219Student();
List<ITECH3219Student> list_InsertStudent = new List<ITECH3219Student>();
list_InsertStudent.Add(student);
}
}
Could you please tell me whats the problem. I should insert an object to file. my object included those fields which has defined at first class.
Thanks for your help.
|
|
|
|
|
I'm not going to try to read all that -- reduce the problem to the minimum amount of code, then format it properly (use <pre></pre> tags as the instructions say).
|
|
|
|
|
Maybe it will be stupid question, but is this code:
Member 4674360 wrote: using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Assignmnet2
{
[Serializable]
class CreateEntry
{
ITECH3219Student student = new ITECH3219Student();
List<itech3219student> list_InsertStudent = new List<itech3219student>();
list_InsertStudent.Add(student);
}
}
copied directly from your code? If it is, then it's invalid (line list_InsertStudent.Add(student);)
You should add this line in the constructor.
|
|
|
|
|
that is unreadable due to the absence of <PRE> tags
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Sorry, could you repeat that my hearing is going?
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: my hearing is going?
I'd better not; if I repeat that once more, it will be gone completely. I could send an e-mail though.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
The problem is in here:
public string Grade
{
get
{
int TotalMark = LabsMark + Ass1 + Ass2 + Final;
if (TotalMark < 40) return "F";
else if (((!Passed()) && TotalMark >=50) || // This line should contain another ')' after "TotalMark >= 50)"
(TotalMark < 50 && TotalMark >= 40))return "MF";
else if ((Passed()) && TotalMark < 60 && TotalMark >= 50)return "P";
else if ((Passed()) && TotalMark < 70 && TotalMark >= 60)return "C";
else if ((Passed()) && TotalMark < 80 && TotalMark >= 70)return "D";
else if (TotalMark > 80) return "HD";
else
return string.Empty;
}
}
|
|
|
|
|
You need to fix your compilation errors first. Other posters have pointed to some of them, the following code is obviously wrong
{
[Serializable]
class CreateEntry
{
ITECH3219Student student = new ITECH3219Student();
List<ITECH3219Student> list_InsertStudent = new List<ITECH3219Student>();
list_InsertStudent.Add(student);
}
}
This code needs to be enclosed by a method or constructor.
It's time for a new signature.
|
|
|
|