Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I just want to check if a string has already been read in C#. this is for my project

thank you for your answer
Posted

You don't. There is no such thing as "checking to see if a string has been read".

Perhaps you need to provide a LOT more detail on the problem and the code involved.
 
Share this answer
 
Comments
Member 11968073 30-Jan-16 23:12pm    
thank you sir this what i like to do

if(string is equal to name)
{
//do something here
}
else if (string has been read)
{
stop();
}
Dave Kreskowiak 30-Jan-16 23:25pm    
Like is said, there is no such thing as "string has been read". Where is this string coming from that you need to track it being "read"? Also, you're still going to have to define what that means.
Member 11968073 30-Jan-16 23:29pm    
what i mean is
if string has been already check
then it will stop();
Dave Kreskowiak 30-Jan-16 23:32pm    
I think your logic is very wrong. This still doesn't make any sense since you're checking the value of the string in the first if statement. The result of "check if string has already been read' would always be true!

What do you hope to achieve with this? Why are you trying to check for this?
Member 11968073 31-Jan-16 0:09am    
this is related to my face recognition project.
what im trying to do is, when the face has been already recognized, i would like to have a message that he/she has been already recognized.

thats all sir
 
Share this answer
 
I think you can check if value has been assigned to the string but it is not logic to check if a string has already been read, code in VB.Net and you may convert to C# if it is OK with you

code should looks
VB
Private IsValueAssigned As Boolean
Public ReadOnly Property IsHaveValue As Boolean
    Get
        Return IsValueAssigned
    End Get
End Property

Private stringValue As String
Public Property ValueString As String
    Get
        Return stringValue
    End Get
    Set(value As String)
        stringValue = value
        IsValueAssigned = True
    End Set
End Property
 
Share this answer
 
v3
Comments
Member 11968073 31-Jan-16 0:41am    
im not that familiar with vb.net haha

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900