|
There is a button that says 'code'...
|
|
|
|
|
Hello,
How can i create C like defines in C#.
What i did so far is:
1.I created class called Global
class Global
{
public const Int32 D_PARAMETER = 5;
public const Int32 NODE_SIZE = 2*D_PARAMETER;
public const Int32 NULL = -1;
}
2.When i want to use some of the const from the class i have to use it like this:
root.Parent = Global.NULL;
3.What can i do so i can only use
NULL and not
Global.NULL ?
Thanks.
|
|
|
|
|
You can't. When you think about it, you'll see why - everything in C# is object-oriented, so there has to be some ability to work with an object, whereas C does not have this restriction.
|
|
|
|
|
Well, think about your design. For me it looks like you want to port C code directly to C# without taking care of the designe (classes, objects, etc)
Anyway you can solve it this way:
static sealed class ConstContainer
{
public static readonly int FOO = 1;
}
And use it that way.
dummy.MyProperty = ConstContainer.FOO;
|
|
|
|
|
You can't, and that's one way in which C# improves on C/C++.
What happens in C/C++ when you include two different header files for two things you want to use that both define NULL, but define different values for it? It doesn't work. So more modern languages use namespaces and such so you can qualify a name when there's a collission.
See also this recent thread and see if there's anything you find helpfull: http://www.codeproject.com/Messages/4235173/Re-include-a-file.aspx[^]
|
|
|
|
|
The story is :
the customers have previous application and database (full with their specific data). Now a new version is ready and the customer gets the update. In the mean time we made some modification on DB (new table, columns, maybe an old column deleted, or whatever). I’m pretty new in Linq and also SQL databases and my first solution can be: I check the applications/databases version and implement all the changes step by step comparing all tables, columns, keys, constrains, etc. (all this new information I have in my dbml and the old I asked from the existing DB). And I’ll do this each time the version changed. But somehow I feel, this is NOT a smart solution so I look for a general solution of this problem.
|
|
|
|
|
A simple forum question is not the right place to answer this. What you are talking about is release management, and is a huge topic in its own right. You have so much to take into account, whether it's a desktop app or ASP.NET, and so on.
I'd suggest that you start with this[^] document.
|
|
|
|
|
i know that.
i have windows app.
what is the strategy?
|
|
|
|
|
As I said, it's more than you can get from a simple forum answer. Follow the link I set for you. Read up on Release and Change management.
If I remember rightly, you've been posting a variant of this question for the last month - in that time, if you'd done some research for yourself, you'd have a working strategy that you could go forward with and find out why you should not rely on client applications in a multi-user environment to update the server.
|
|
|
|
|
What you're talking about should NEVER be done at run-time. This is all install-time work for you server components. You do that stuff in your installer, not your application.
Seriously, read that document. You've wasted enough time plodding through the forums trying to piece this together from forum posts. Don't screw this up by guessing and overlooking the holes forum posts are going to leave in your "strategy".
|
|
|
|
|
I will be doing my final year project later this year and i want to develop an application. Almost everybody is developing a website. I want to do something different something like a distributed system using Preferably WCF or TCP/IP sockets using C#. Please guyz i need ideas i could implement using these tools.
Thanks
|
|
|
|
|
solomon201 wrote: Please guyz i need ideas i could implement using these tools
You and every other finals student on the planet, we see this question regularly and it usually gets a rehash of old ideas, do a search for project ideas or final exam and see what you get.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
.................
modified 16-May-12 3:26am.
|
|
|
|
|
Qismet, go find someone who can translate your requirements into english for you, your question makes absolutely no sense!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
(C#) language
i am making a website in which i want to added a facility in which if the user is idle for some minutes not at the time of working but if and only if idle then it redirect to the Login Page.
So please help me...
Mitesh
|
|
|
|
|
|
Sandeep Mewara wrote: ASP.NET question
Major assumption, he could be talking about a Silverlight application - and he is still in the wrong forum
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
... or Apache/PHP, in which case, he's still....
... ... or ... or ...
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
ok so I'm just as self absorbed as Sandeep.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah.
|
|
|
|
|
How can to convert XML file to Datatable via C#.
My XML file is :
<CheckRepeatedOstan sp_PersianName = "check the repeted item" >
<CheckRepeatedPerson sp_PersianName = "check which person is repeated" >
<DeleteAddressbyIdPerson sp_PersianName = "" >
<DeleteAddressType sp_PersianName = "" >
<DeleteAutoAnsRecivedSMS sp_PersianName = "" >
<DeleteAutoAnsTitle sp_PersianName = "" >
<DeleteCompitionTitle sp_PersianName = "" >
<DeleteCompititionRecivedSms sp_PersianName = "" >
<DeleteDraftGroups sp_PersianName = "" >
<DeleteDraftMessage sp_PersianName = "" >
<DeleteEmailbyIdPerson sp_PersianName = "" >
<DeleteFullGroupClickedByIdTitle sp_PersianName = "" >
<DeleteGroups sp_PersianName = "" >
<DeleteGruopAutoAns sp_PersianName = "" >
<DeletePersonByIdPerson sp_PersianName = "" >
<DeletePhonebyIdPerson sp_PersianName = "" >
<DeletePhoneType sp_PersianName = "" >
<DeleteProvince sp_PersianName = "" >
and now i wanna to have table something link bellow :
SP_Name || SP_PersianName
CheckRepeatedOstan || check the repeted item
CheckRepeatedPerson || check which person is
|
|
|
|
|
I need to work with some very large integers; about 100 decimal places. Therefore, I thought I would use the data type BigInteger. However, the following program does not compile:
using System;
using System.IO;
using System.Numeric;
class MainClass {
public static void Main()
{
BigInteger i1;
}
}
I get the following error message:
Error 1 'System.Numeric.BigInteger' is inaccessible due to its protection level C:\dev\C#.dev\test\main.cs 8 9 test
Should I be using a different data type? Why does this simple program not compile?
Thanks
Bob
|
|
|
|
|
That bizarre message is what one gets when compiling with an old .NET version. BigInteger type got introduced in .NET 4.0, hence this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
BigInteger a = 12;
Console.WriteLine("a=" + a);
Console.ReadKey();
}
}
}
works just fine on Visual Studio 10, targetting .NET 4.0
Please note the extra s in the using statement.
|
|
|
|
|
Thanks for the response. I am back on version 3.5. Is there a bignum class in version 3.5? If so, what is it?
Bob
|
|
|
|
|
No. However you could:
- create your own; which is a painful job, the size of which depends on the exact operations you want available. Addition and multiplication are easy; division, and square rooting are hard; everything else is hard if you want maximum performance.
- read some CP articles on such subject (I once did that and I must warn you they have wildly varying quality)
- try and use a very old Java implementation (it used to also be part of Microsoft's defunct Visual J#, search for vsjlib.dll)
- look inside the .NET 4.0 implementation and port that to .NET any version using Reflector or some such;
- conclude that the one real solution is called .NET 4.0
|
|
|
|