Click here to Skip to main content
15,917,997 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Proof of the .NET 3.0 Installation Pin
Scott Dorman4-May-07 4:08
professionalScott Dorman4-May-07 4:08 
AnswerRe: Proof of the .NET 3.0 Installation Pin
kubben3-May-07 14:04
kubben3-May-07 14:04 
GeneralRe: Proof of the .NET 3.0 Installation Pin
Brendan Vogt3-May-07 19:57
Brendan Vogt3-May-07 19:57 
GeneralRe: Proof of the .NET 3.0 Installation Pin
kubben4-May-07 1:53
kubben4-May-07 1:53 
GeneralRe: Proof of the .NET 3.0 Installation Pin
Pete O'Hanlon4-May-07 2:43
mvePete O'Hanlon4-May-07 2:43 
Questionhow can i send image through MSMQ Pin
nikhil12342-May-07 21:51
nikhil12342-May-07 21:51 
AnswerRe: how can i send image through MSMQ Pin
Brady Kelly3-May-07 0:35
Brady Kelly3-May-07 0:35 
Jokechange attribute property values Pin
urbane.tiger2-May-07 18:04
urbane.tiger2-May-07 18:04 
how does one change the properties of an attribute at run time. The quasi-code at the end hereof is an attempt to show what I want to do.

It seems that even tho member's can change the value of their own and other members attributes (via the attributes property set accessors), when another member gets that attribute the attribute's state variables revert to their compile (load) time value. If you can follow my code, the interrogation of StringProperty's myStateAttribute in the SomeMethod code always yields a value of myStates.InitialValue in the State property of the myStateAttribute attached to the StringProperty, even tho it gets changed to InError or CurrentValue in the StringProperty set accessor.

In this code the attributes content is pertinent to the runtime state of the member instance to which it's applied, i.e. it is <u>dynamic</u> metadata rather than static metadata such as DisplayName etc.

<code>
enum myStates{InitialValue, InError, HasChanged, CurrentValue,}
class myStateAttribute : Attribute {
public myStates State {get this.theState;}set{this.theState=value;}
public myStateAttribute() {
this.State = myStates.InitialValue;
}
private myStates theState;
}
...
[myState()]
string StringProperty {
get {return this.theStringProperty)
set (
{
PropertyInfo _p = this.GetType().GetProperty(_n, BindingFlags....
object[] _o = _p.GetProperty(typeof(myStateAttribute);
myStateAttribute _a;
if (_o.Length == 1 && _o is myStateAttribute){
_a = (myStateAttribute) _o;
else
throw new ApplicationException("whoops, forgot the myState attribute");

if (value!=null &&
value.Length < Properties.Settings.MinStringSize ||
value.Length > Properties.Settings.maxStringSize) {
string _n = new StackTrace().GetFrame(0).GetMethod().Name.SubString(4);
_a.State = myStates.InError;
}
else
a.State = myStates.CurrentValue;
}
}
}
.......

private whatever SomeMethod()
{
...
data.PropertyString = someOtherString;
interrogate PropertyString's myStateAttribute and act accordingly
}
</code>
GeneralRe: change attribute property values Pin
Pete O'Hanlon2-May-07 22:57
mvePete O'Hanlon2-May-07 22:57 
GeneralRe: change attribute property values Pin
urbane.tiger4-May-07 15:36
urbane.tiger4-May-07 15:36 
QuestionMachine.config setting for firewall changes Pin
tom groezer1-May-07 21:24
tom groezer1-May-07 21:24 
AnswerRe: Machine.config setting for firewall changes Pin
Paul Conrad14-Jul-07 6:49
professionalPaul Conrad14-Jul-07 6:49 
QuestionMachine.config setting for firewall changes Pin
tom groezer1-May-07 21:24
tom groezer1-May-07 21:24 
Questionnew to .NET Pin
Sunshine Always1-May-07 20:03
Sunshine Always1-May-07 20:03 
AnswerRe: new to .NET Pin
Blumen3-May-07 23:17
Blumen3-May-07 23:17 
QuestionWhich OR/M Tool do you prefer Pin
MartyPitt1-May-07 13:58
MartyPitt1-May-07 13:58 
AnswerRe: Which OR/M Tool do you prefer Pin
Pete O'Hanlon1-May-07 22:50
mvePete O'Hanlon1-May-07 22:50 
QuestionSelecting comms in C# Pin
xlthim1-May-07 5:35
xlthim1-May-07 5:35 
QuestionWhere can I find... Pin
Mark0630-Apr-07 0:18
Mark0630-Apr-07 0:18 
AnswerRe: Where can I find... Pin
George L. Jackson30-Apr-07 16:34
George L. Jackson30-Apr-07 16:34 
AnswerRe: Where can I find... Pin
Brady Kelly1-May-07 10:15
Brady Kelly1-May-07 10:15 
QuestionChange textbox on reportviewer Pin
FrankBoonen30-Apr-07 0:07
FrankBoonen30-Apr-07 0:07 
Question302 Redirect - Double Get Pin
Tristan Rhodes29-Apr-07 23:54
Tristan Rhodes29-Apr-07 23:54 
QuestionStrange Problem With Windows Forms In VB.NET Pin
unix_blues29-Apr-07 20:58
unix_blues29-Apr-07 20:58 
QuestionGetting strange error when running a simple remoting app on Vista Pin
consolejoker28-Apr-07 6:54
consolejoker28-Apr-07 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.