|
Does anybody know if it is possible to use generics
in an attribute ?
Example: (what I would like to do)
class MyClass <T>{
[MyAttribute(T == typeof(ClassCase1) ? "Case1" : "Case2")]
private object MyProp{
get{...}
set{...}
}
}
Thanks
May u have a bug free day...
|
|
|
|
|
Unfortunately you can't reference a generic type parameter in an attribute, so you can't use T == in your attribute.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i have a custom control which has a magnification property. when we change to 'double width' value, it should stretch the font on the control to double width but the height has to remain the same. similarly i have to stretch the font along y axis when 'double height' is selected for magnification. we cannot separately set the height and width of the FONT. Please help me achieve this.
Thanks
Priya
|
|
|
|
|
Hi anyone !
I have some problem with my listview.
I read from database and find 10 items. I add them to listview and listview show 10 items.
So... then I add one item to database and then i read database again, and find 11 items (i checked in debug mode). I add every each to the listview BUT, the listview just shows 10 items. (the one already there).
Whats wrong ???
If i execute in debug mode the problems does not occur. Because it goes slower ?? or what ??
Anyone that have any ideas ?
With Kind Regars
Heino
|
|
|
|
|
henur wrote: then I add one item to database
How are you doing this? Using some other program or manually, using Query Analyzer and the like? Also, are you sure your query is being committed?
Posting the relevant code snippet might be useful.
Cheers,
Vikram.
"But nowadays, it means nothing. Features are never frozen, development keeps happening, bugs never get fixed, and documentation is something you might find on wikipedia."
- Marc Clifton on betas. Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
It's done manually. Reading a datareader and adding items by items.
If i execute in debug-mode i see information about every post, even the one that is not added to the listview.
Heino
|
|
|
|
|
Hi.
I'm handling the event on Windows clock change:
public static EventHandler timeChanged = new EventHandler(OnTimeChanged);
Microsoft.Win32.SystemEvents.TimeChanged += timeChanged;
public static void OnTimeChanged(object sender, EventArgs e)
{
// Do something....
}
Problem: I don't know how to get the part of date that has been changed: days, minutes etc.
Does somebody know how to do it?
Thanks.
Vadim G.
|
|
|
|
|
hi there.
i've got a problem. currently i'm developing a .net webservice and i need to access windows network shares from within that webservice. some of the shares are located inside the domain the server is a member of where the webservice runs, some are located on servers which are members of foreign domains where the domain the webservice server belongs to has no security trust, thus it is a foreign domain.
i'm unable to figure out how to parse the credentials to the directory- and/or fileInfo objects when creating them using the uncPath to the share(s). i tried impersonation which works well for accessing shares within the same domain the webservice server belongs to, but not for the domain it does not belong to.
i think the problem is, that the underlaying implementation of the impersonation class i use - advapi32.dll - does not know the domain controler(s) it should use to authenticate the credentials i use for the impersonation.
maybee im wrong with this thinkings...
PLZ, can anyone help me with this problem? its realy urgent, i need to get this working!
thank you very much,
dialsc
|
|
|
|
|
Hello..
i'm beginner in c# and have problems with implementing some things in my project...
i need to draw circle (ellipse) as car and different roads (from couple segments) on some map
and to be able to peek a road and navigate such car on this road and also noise if the car gets out from the road... something like this..
I tried to read some good articles here.. but i missed the main idea of such design and also do i need directx?
Thanks for any help...
Shimon
|
|
|
|
|
Hi,
I'm creating a COM object single dll server in C++, which will be used in managed code, in C#. I'm having a little trouble with types . I need to declare method wich will have one input argument and one output argument, both of string type (in C#). Now I work with arguments :
C++
HRESULT Method([in] unsigned char const* source, [out, retval] unsigned char* output);
which are (in C#) converted to :
byte Method(ref byte source);
1. what kind of declaration I need in C++, so it would be transformed to string Method(string source) (in C#);
2. How to convert that kind to char* (in C++).
thanks
|
|
|
|
|
|
Idea - what I want to do:
<br />
struct AtomicInt<br />
{<br />
Int32 m_value;<br />
public static int operator++(ref AtomicInt ai) { Interlocked.Increment(ai.m_value); });<br />
}<br />
operator ++ has to modify the struct itself, but ref doesn't seem to be allowed for operators. So I either have toi make AtomicInt a class (sucks), or I can't provide a meaningful overload for operator ++ - or am I missing something?
|
|
|
|
|
This works for me:
public struct AtomicInt
{
Int32 m_value;
public static AtomicInt operator++ (AtomicInt ai)
{
Interlocked.Increment(ref ai.m_value);
return ai;
}
public override string ToString()
{
return m_value.ToString();
}
}
...
AtomicInt ai = new AtomicInt();
Console.WriteLine(ai);
Console.WriteLine(++ai);
Console.WriteLine(ai++);
Console.WriteLine(ai);
Hope this helps.
|
|
|
|
|
ah yes, that's probably how it's intended to work, but that defeats the purpose
|
|
|
|
|
Ok, then perhaps this is saver:
public struct AtomicInt
{
Int32 m_value;
public AtomicInt(Int32 value)
{
m_value = value;
}
public static AtomicInt operator++ (AtomicInt ai)
{
int i = Interlocked.Increment(ref ai.m_value);
return new AtomicInt(i);
}
public override string ToString()
{
return m_value.ToString();
}
}
|
|
|
|
|
I'm still not sure if this is handled correctly internally.
As I guess, what the IL really does is
AtomicInt x; <br />
++x;<br />
==>
<br />
AtomicInt x;<br />
x = AtmicInt.op_Increment(x);<br />
which wouldn#t work as intended. I guess I should check with reflector.
|
|
|
|
|
I assume, that's correct, but then you have to protect the Increment operation (e.g. per lock on any object) outside of the structs code, and this is not what you want ...
|
|
|
|
|
A struct should generally be immutable, so perhaps you should make it a class after all.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: A struct should generally be immutable
But the inbuild structs are also not, eg: Rectangle.Offset()
|
|
|
|
|
Yes, some structures are not immutable, but most are. It has been questioned many times if making those mutable was a good move or not.
If you make a mutable struct, you should be aware that it doesn't work as a property in a class, you can only use it locally.
---
single minded; short sighted; long gone;
|
|
|
|
|
can anyone tell me why the hell do I get up site down question marks when I try to save Arabic text in Oracle?? it's a simple database application created using VS 2005 wizard.
Please guys help, I've been working this out for a week now!! I'm really desperate now
Thanx a bunch guyz
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Didn't you ask this before ? Are you saving to nvarchar, so the strings can be unicode ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hey,
Is it possible to generate the encrypted string(output of maximum 15 characters) of fixed length using Rijndael encryption or any other symmetric algorithm?
If anybody knows pls let me know.Its very urgent (:-
Thanks
Kusuma
|
|
|
|
|
Please don't post the same question multiple times.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
the 15 char limit spells homework to me. WHy break one rule when you can break several.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|