|
hi,
how can i remove the this error "Unsafe code may only appear if compiling with /unsafe" ?
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
Does it point you to any code?
Are you using pointers anywhere?
|
|
|
|
|
hi,
by adding /unsafe to the command line when invokind csc.exe,
or by checking the "unsafe" checkbox in Visual's project properties page.
|
|
|
|
|
Hi,
I have some problem using vector in C#.
for example I have vector of double, let say double[] vec1 = new double[] {1, 3, 5, 6, 7, 8, 9 };
And I want to get a view on a part of this vector without copy.
Let say I want to get the vector: double [] vec2=new double[]{5, 6, 7};( which is a part of vec1)
without creating a new vector or without copy the initial vector.
In C++ I can use iterator: data_it_begin = vec1.begin() + 2;data_it_end = vec1.begin() + 5.
I don't how to this in C#.
Does someone can help me.
Thanks!!!
|
|
|
|
|
for(int i=2; i<5; i++)
{
}
|
|
|
|
|
Yes you are right. But I don't want to do that.
I will try to explain again.
As I say.
If I have a fuction Test1( double[] x)
{
/// I can loop on vector element
}
Instead of doing thant I prefer
Test2(std::vector<double>::iterator begin,std::vector<double>::iterator end)
{
//I can loop on element
}
For Test2, there is no need to copy the vector, I just need to pass iterator.
like
std::vector < double > vec1,
Test2(vec1.begin() + 3 , vec1.begin()+ 5), without copy the vector.
For Test1, I have to copy, vec2 = new double[]{vec1[3], vec1[4],vec1[5] }
before Test1(vec2).
I think it more clear!!!
|
|
|
|
|
Hi,
a lot of methods that operate on arrays have an overload taking a start index and a
length. Example:
public static void Sort (
Array array,
int index,
int length
)
That is the easiest way to have them work on a contiguous subset of array elements.
|
|
|
|
|
Ok thanks, I think that is easiest way.
I think I need to pass the vector and the indexBegin and endEnd.
public void Test( double[] vec,int indexBegin,int indexEnd)<br />
{<br />
}<br />
So If one has a big vector It can call the method without copy the vector just doing
Test( vector, 2,3).
So there is no more elegant way to do this in C# as in C++( using STL).
|
|
|
|
|
Hi,
in .NET those simple collections are called arrays, not vectors.
and by convention a subset of most collections is defined by start and length,
not start and end.
yes, all .NET languages have enumerators too, but I pointed you to the easiest solution.
|
|
|
|
|
How to add to it more functions and still use Math.SomeFunction() convention.
Math class is static, that is sealed. Is it possible to use partial or any other mechanisms?
chesnokov
|
|
|
|
|
Chesnokov Yuriy wrote: How to add to it more functions and still use Math.SomeFunction() convention.
Math class is static, that is sealed. Is it possible to use partial or any other mechanisms?
You can't. Create your own utility class for the additional functions.
|
|
|
|
|
You can't add anything to a sealed class.
With C# 3.0 however, which ships with Visual Studio 2008, you can use a technique called "extension methods" to certain datatypes.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Use a utility class like this
public static class AdvancedMath
{
//Only if you want to call the method from here
//Or rewrite the signature of the methods/properties you want
public static decimal Abs(decimal value)
{
return Math.Abs(value);
}
//add any additional methods/properties you may have
public static double MySpecialMethod(double value)
{
//do your special processing and return the result
}
}
|
|
|
|
|
Just create your own math class.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi
I creted a C# dll which is used to perform Word Merge Process. In that I need the Last modified Time of the Word Document. I know that in VB / VB.Net we can use BuiltInDocumentProperties(WdPropertyTimeLastSaved) to get the last modified time. But in C#, I am not able to see this syntax. It is giving an error and BuiltInDocumentProperties is of 'object' type.
I want to use the same BuiltInDocumentProperties in another area where I want to assign, BuiltInDocumentProperties(wdPropertyKeywords)= "A set of keywords from the xml file like <FileName> <Address> etc";
Can anybody tell me how can I solve these two as it is possible in VB.Net
With Regards,
Abraham Chethuvelil
|
|
|
|
|
If you really can perform these operations your talking about in VB.NET, then it can be done in C#. Just convert your VB.NET code to C#
Just because we can; does not mean we should.
|
|
|
|
|
Hi
I have developed a project in which i am using a external dll file
now i created a setup project ..
so whenever i am installing it on the clients PC .its giving a error
error is bcoz of that dll which was not added to the Clients GAC so how to do this i have tried these things
1. Added the reference of DLL while developing the software
2. Added the Dll To the GlobalAssemblyCache folder while doing setup
the above things dint work
when i published that project it worked
i want to do this thru the setup project .......
if anyone knows this then plz do let me know
regards
sindhu tiwari
Always Innovative
|
|
|
|
|
Did you create the DLL yourself, or is it a 3rd party DLL?
I don't know much about this, but I just recently read (in a book) some things about using 3rd party DLL's.
One of the drawbacks of using somebody else's DLL is that you supposedly cannot add it to the GAC yourself, because it's not digitally signed by YOU.
So, you'll need to manually copy the DLL to the same folder as your exe, if I remember correctly.
Beyond this, I am worthless, having never created a setup program for a .Net product yet...
|
|
|
|
|
thanks allot for ur reply......ya its a third party Dll
.....a question is copying dll to same folder will solve the problem
sindhu tiwari
its me sid
|
|
|
|
|
|
HI
i want run my web application in different system by hosting it to iis
help me with the procedure to deploy application along with database.........
thanx in advance
|
|
|
|
|
What is it you are having trouble with?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
i'm try to design stock applications so i need to retrieve data from database for every one minutes...give source code using c#
sg
|
|
|
|
|
run a thread or timer ....i prefer thread ....
show the data in the datagrid view....
refresh fuction may also work
i hope this will solve problem...if not experts are here
its me sid
|
|
|
|
|
ramesh_imayam wrote: i'm try to design stock applications so i need to retrieve data from database for every one minutes...give source code using c#
Since we know nothing about your application design that would be difficult to give you source code that you can use. For example, what tables and columns do you need to retrieve from the database? Or are you using stored procedures? What database are you using? etc.
However, there are several parts to the question, and we can help on specific parts if we know more about your application. What specifically are you stuck with?
* How to perform an action at a required interval?
* How to retrieve information from a database? (ADO.NET)
* How to query the database? (SQL)
|
|
|
|