• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Oct 03, 2013 at 10:29 AM by Fattie for the following reason:

Duplicate Question

avatar image
0
Question by MH1 · Sep 02, 2013 at 01:42 AM · c#textstringread

How to put each line of a text file into a separate sring c#

I have a text file created and added to in c#. I want to know how I can than get that information and store aech line of the text document in separate strings.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by ShadoX · Sep 02, 2013 at 07:27 AM

You could try reading all the info from the file via http://msdn.microsoft.com/en-us/library/vstudio/ezwyzy7b.aspx into an ArrayList.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MH1 · Sep 03, 2013 at 01:15 AM 0
Share

I already made all the variables; (because each variable is displayed on a GUI button) I want to put each line into a totally separate variable. Thanks.

avatar image Eric5h5 · Sep 03, 2013 at 02:02 AM 1
Share

@ShadoX: You wouldn't ever want to use an ArrayList. Use a built-in array, or a generic List.

@$$anonymous$$H1: You really don't want to use separate variables; that's a nightmare. Use arrays or lists.

avatar image ShadoX · Sep 03, 2013 at 07:14 AM 0
Share

$$anonymous$$y bad,I don't usually use C# so I was pretty much just looking for something where you don't have to define the list size. Thanks for the info @Eric5h5

avatar image Eric5h5 · Oct 03, 2013 at 03:15 PM 0
Share

@Fattie: please never convert my comments into answers. They are comments because they don't answer the question, they are commenting on someone else's answer. How in the world would my previous comment make sense as an answer out of context? Hint: it doesn't!

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Remove the & at the end of concatenated string 0 Answers

Ui text to string ? 1 Answer

A little bit of help is needed!!! 1 Answer

Multiple Cars not working 1 Answer

Best way to manage stats in a text file 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges