PDA

View Full Version : مبتدی: خطا در تعریف متغیر public



m.toosi
یک شنبه 08 آبان 1390, 23:58 عصر
من این برنامه رو از تو اینترنت گیر آوردم و احتیاج دارم به تحویل دادن اون و اجراش
ولی چون یادم رفته برنامه نویسی با #C نمیتونم خطا یابی کنم
اگر امکان داره راهنمایی کنید
// Searches passed text and returns all occurrences of any keyword

// Returns array containing positions of found keywords

public StringSearchResult[] FindAll(string text)
{
ArrayList ret=new ArrayList(); // List containing results

TreeNode ptr=_root; // Current node (state)

int index=0; // Index in text


// Loop through characters

while(index<text.Length)
{
// Find next state (if no transition exists, fail function is used)

// walks through tree until transition is found or root is reached

TreeNode trans=null;
while(trans==null)
{
trans=ptr.GetTransition(text[index]);
if (ptr==_root) break;
if (trans==null) ptr=ptr.Failure;
}
if (trans!=null) ptr=trans;

// Add results from node to output array and move to next character

foreach(string found in ptr.Results)
ret.Add(new StringSearchResult(index-found.Length+1,found));
index++;
}

// Convert results to array


return (StringSearchResult[])ret.ToArray(typeof(StringSearchResult));

از این خطا میگیره : StringSearchResult[]
و همچنین این ArrayList()

متاسفانه وقتی یک مدت برنامه نمی نویسی همینجوری میشی :گریه:

ehsanara
دوشنبه 09 آبان 1390, 00:37 صبح
بین string و search فاصله باید باشه
public String SearchResult[]