Texture to face

can any one help me
i have created mesh and add vertices to it then add faces by this vertices
how can i add texture to this face

``````   public static Rhino.Commands.Result AddRoofMesh(Rhino.RhinoDoc doc, Point3d[] points)
{
Point3d p1 = points[0];
Point3d p2 = points[1];
Point3d p3 = points[2];
Point3d p4 = points[3];
Rhino.Geometry.Mesh mesh2 = new Rhino.Geometry.Mesh();

Point3d p5 = new Point3d(p1.X, p1.Y, p1.Z);
Point3d p6 = new Point3d(p2.X, p2.Y, p2.Z);
Point3d p7 = new Point3d(p3.X, p3.Y, p3.Z);
Point3d p8 = new Point3d(p4.X, p4.Y, p4.Z);

float[][] faces = new float[][] { new float[] { (float)p1.X, (float)p1.Y, (float)p1.Z }, new float[] { (float)p2.X, (float)p2.Y, (float)p2.Z }, new float[] { (float)p3.X, (float)p3.Y, (float)p3.Z } };
float[] norm = new float[3];
calcNormal(faces, out norm);
Point3d pntNormal = ReduceToUnit(norm);
double thick = .2;
p5.X += (pntNormal.X * thick);
p5.Y += (pntNormal.Y * thick);
p5.Z += (pntNormal.Z * thick);

p6.X += (pntNormal.X * thick);
p6.Y += (pntNormal.Y * thick);
p6.Z += (pntNormal.Z * thick);

p7.Y += (pntNormal.Y * thick);
p7.X += (pntNormal.X * thick);
p7.Z += (pntNormal.Z * thick);

p8.X += (pntNormal.X * thick);
p8.Y += (pntNormal.Y * thick);
p8.Z += (pntNormal.Z * thick);

mesh2.Compact();
{
doc.Views.Redraw();
return Rhino.Commands.Result.Success;
}
return Rhino.Commands.Result.Failure;
}
``````

this is my code

To assign a texture to an object, you will first need to create a material, and then assign that texture to the material. Once you’ve done this, you can assign the material to the object (not the geometry).

Let me know if you need an example.

– Dale

I know this and try to add materisl
But cwn not assign to this face cwn yiu send me exsmple c#