|
Then you want to use a readonly variable and set it's value at runtime in the object's constructor.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I thought of that, but the data that comes back determines whether the property should be
read only or not. This occurs after the CTOR:
MyClass o = new MyClass()
o.MethodCall()
Everything makes sense in someone's mind
|
|
|
|
|
Then, yeah, set a bool that means it's locked. Done.
|
|
|
|
|
Use a readonly variable. Set it to a value in the constructor of your class.
You cannot modify once your code is out of the constructor.
|
|
|
|
|
C# has no build-in way to do this (changing whether something is readonly at runtime) so you'll have to do it manually .. that's actually trivial though
But of course, if you have to enforce it, that means that some other component is trying to set that property anyway (enforcing a rule no one is trying to break is useless) - can't you just tell it to stop doing that?
|
|
|
|
|
Check out the property DesignMode which is part of all components. I presume you want this so you can have the designer set the properties but no one else when it running.
|
|
|
|
|
Hello
i am trying to split the text to 5 string and i do not know how to do?
r1
<5ADW_DWDW:002311S> <HAKEJH IIEAZ TEENK H TGESA ST/SP STDTE>
<12-23-10> <14:01:39:1> <RUN FTTTR ALM> r0
I indicate the values that must be together with <text>
|
|
|
|
|
I have no idea what you're asking -- but try a Regular Expression.
|
|
|
|
|
It is difficult to work out exactly what you need. Is the input data in a fixed format? I.e. are the sections you need as separate strings always in the same place but within different strings? If so, then use String.Substring[^] - the second form will allow you to select the start position and length of each individual string.
If they aren't in fixed columns, then you either need to establish lead-in and tail-out sequences and then use a regular expression, or manually parse the string character by character to extract the data.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
It is basically comes in this structure but the length of the strings changes.
i can regex the date as (\d{1,2}\-\d{1,2}\-\d{1,2}) and time (\d{1,2}\:\d{1,2}\:\d{1,2}\:\d{1,2})
but the others are a bit challenge .
|
|
|
|
|
But it seems you want
(ignore whitespace)
The first contiguous series
(ignore whitespace)
Everything before the date
(ignore whitespace)
The date
(ignore whitespace)
The time
(ignore whitespace)
Everything else
(ignore whitespace)
That's not difficult; download Expresso or try my RegexTester[^].
|
|
|
|
|
Thanks for the advices i am going to look at them
|
|
|
|
|
Have you looked at String.Split() using ">" and "<" as separators?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
the string comes as
r1
5ADW_DWDW:002311S HAKEJH IIEAZ TEENK H TGESA ST/SP STDTE
13-23-33 14:01:39:1 RUN FTTTR ALM r0
i only define the parts that i want.
|
|
|
|
|
OK, so how do you know where the substrings that you want start and end?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I know it .
I didn't wrote the right text this is similar to the right one.
|
|
|
|
|
????
First, determine what rule you use to separate (parse) the text into substrings. Once you can tell us that, then we can help you put together some code that will do it. Usually, once you know what the parsing rule is, the code is trivial.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
It seems you want to offer your help at the easier part of the job then.
|
|
|
|
|
Yeah, I'm pretty good at easy things!
I could conjecture on splitting at line breaks, then on long sequences of spaces or things that look like dates and times, but if the OP doesn't know that, then I don't see any way to parse the strings.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
sir, I want to create a blog for student blog for recruitment.I want to code to create.
So,please help me sir.
Thanks
in Advance.
|
|
|
|
|
Read the FAQs, look at all the responses to requests for code, then understand why I voted 1. A request for me to do your work for you, no matter how politely put, is still just that.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
First of all I actually don't understand what it is you're asking for.
Second of all, neither me or anyone else in here is gonna do it for you.
|
|
|
|
|
|
I want to make an application consisting of text boxes, radio buttons and check buttons. I did it in visual basic.
But i want to know that is there is any difference between what we program in Code Blocks and in Visual C ?
|
|
|
|
|
1) The title has nothing to do with C#
2) The question makes no sense at all
I know the language. I've read a book. - _Madmatt
|
|
|
|